Add option to define factory as static method.