Add Factory Method sample code.