A generic configurable factory for creating an object.