public class DefaultCreator extends Object implements ObjectFactory
| Constructor and Description |
|---|
DefaultCreator()
Creates a new DefaultCreator with no options
|
DefaultCreator(MapperOptions options)
Creates a new DefaultCreator with options
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
createInst(Class<T> clazz)
Deprecated.
use
createInstance(Class) instead |
<T> T |
createInstance(Class<T> clazz)
Creates an instance of the given class.
|
<T> T |
createInstance(Class<T> clazz,
DBObject dbObj)
Creates an instance of the class defined in the
Mapper.CLASS_NAME_FIELDNAME field in the dbObject passed in. |
Object |
createInstance(Mapper mapper,
MappedField mf,
DBObject dbObj)
Creates an instance of the class defined in the
Mapper.CLASS_NAME_FIELDNAME field in the dbObject passed in. |
List |
createList(MappedField mf)
Defines how morphia creates a List object.
|
Map |
createMap(MappedField mf)
Defines how morphia creates a Map object.
|
Set |
createSet(MappedField mf)
Defines how morphia creates a Set object.
|
protected ClassLoader |
getClassLoaderForClass() |
Map<String,Class> |
getClassNameCache() |
public DefaultCreator()
public DefaultCreator(MapperOptions options)
options - the options to apply@Deprecated public <T> T createInst(Class<T> clazz)
createInstance(Class) insteadT - the type of the classclazz - the Class of the type to createpublic <T> T createInstance(Class<T> clazz)
ObjectFactorycreateInstance in interface ObjectFactoryT - the type of the entityclazz - type class to instantiatepublic <T> T createInstance(Class<T> clazz, DBObject dbObj)
ObjectFactoryMapper.CLASS_NAME_FIELDNAME field in the dbObject passed in. If that field
is missing, the given Class is used instead.createInstance in interface ObjectFactoryT - the type of the entityclazz - type class to instantiatedbObj - the state to populate the new instance withpublic Object createInstance(Mapper mapper, MappedField mf, DBObject dbObj)
ObjectFactoryMapper.CLASS_NAME_FIELDNAME field in the dbObject passed in. If that field
is missing, morphia attempts to the MappedField to determine which concrete class to instantiate.createInstance in interface ObjectFactorymapper - the Mapper to usemf - the MappedField to consult when creating the instancedbObj - the state to populate the new instance withpublic List createList(MappedField mf)
ObjectFactorycreateList in interface ObjectFactorymf - the MappedField containing any metadata that might define the type of the List to createpublic Map createMap(MappedField mf)
ObjectFactorycreateMap in interface ObjectFactorymf - the MappedField containing any metadata that might define the type of the Map to createpublic Set createSet(MappedField mf)
ObjectFactorycreateSet in interface ObjectFactorymf - the MappedField containing any metadata that might define the type of the Set to createprotected ClassLoader getClassLoaderForClass()