public interface ObjectFactory
| Modifier and Type | Method and Description |
|---|---|
<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.
|
<T> T createInstance(Class<T> clazz)
T - the type of the entityclazz - type class to instantiate<T> T createInstance(Class<T> clazz, DBObject dbObj)
Mapper.CLASS_NAME_FIELDNAME field in the dbObject passed in. If that field
is missing, the given Class is used instead.T - the type of the entityclazz - type class to instantiatedbObj - the state to populate the new instance withObject createInstance(Mapper mapper, MappedField mf, DBObject dbObj)
Mapper.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.mapper - the Mapper to usemf - the MappedField to consult when creating the instancedbObj - the state to populate the new instance withList createList(MappedField mf)
mf - the MappedField containing any metadata that might define the type of the List to createMap createMap(MappedField mf)
mf - the MappedField containing any metadata that might define the type of the Map to createSet createSet(MappedField mf)
mf - the MappedField containing any metadata that might define the type of the Set to create