Class DefaultCreator

  • All Implemented Interfaces:
    ObjectFactory

    public class DefaultCreator
    extends java.lang.Object
    implements ObjectFactory
    Author:
    ScottHernandez
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      <T> T createInst​(java.lang.Class<T> clazz)
      Deprecated.
      java.lang.Object createInstance​(Mapper mapper, MappedField mf, com.mongodb.DBObject dbObj)
      Creates an instance of the class defined in the discriminator field in the dbObject passed in.
      <T> T createInstance​(java.lang.Class<T> clazz)
      Creates an instance of the given class.
      <T> T createInstance​(java.lang.Class<T> clazz, com.mongodb.DBObject dbObj)
      Creates an instance of the class defined in the discriminator field in the dbObject passed in.
      java.util.List createList​(MappedField mf)
      Defines how morphia creates a List object.
      java.util.Map createMap​(MappedField mf)
      Defines how morphia creates a Map object.
      java.util.Set createSet​(MappedField mf)
      Defines how morphia creates a Set object.
      java.util.Map<java.lang.String,​java.lang.Class> getClassNameCache()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultCreator

        public DefaultCreator()
        Creates a new DefaultCreator with no options
      • DefaultCreator

        public DefaultCreator​(MapperOptions options)
        Creates a new DefaultCreator with options
        Parameters:
        options - the options to apply
    • Method Detail

      • createInst

        @Deprecated
        public <T> T createInst​(java.lang.Class<T> clazz)
        Deprecated.
        Type Parameters:
        T - the type of the class
        Parameters:
        clazz - the Class of the type to create
        Returns:
        the new instance
      • createInstance

        public <T> T createInstance​(java.lang.Class<T> clazz)
        Description copied from interface: ObjectFactory
        Creates an instance of the given class.
        Specified by:
        createInstance in interface ObjectFactory
        Type Parameters:
        T - the type of the entity
        Parameters:
        clazz - type class to instantiate
        Returns:
        the new instance
      • createInstance

        public <T> T createInstance​(java.lang.Class<T> clazz,
                                    com.mongodb.DBObject dbObj)
        Description copied from interface: ObjectFactory
        Creates an instance of the class defined in the discriminator field in the dbObject passed in. If that field is missing, the given Class is used instead.
        Specified by:
        createInstance in interface ObjectFactory
        Type Parameters:
        T - the type of the entity
        Parameters:
        clazz - type class to instantiate
        dbObj - the state to populate the new instance with
        Returns:
        the new instance
      • createInstance

        public java.lang.Object createInstance​(Mapper mapper,
                                               MappedField mf,
                                               com.mongodb.DBObject dbObj)
        Description copied from interface: ObjectFactory
        Creates an instance of the class defined in the discriminator field in the dbObject passed in. If that field is missing, morphia attempts to the MappedField to determine which concrete class to instantiate.
        Specified by:
        createInstance in interface ObjectFactory
        Parameters:
        mapper - the Mapper to use
        mf - the MappedField to consult when creating the instance
        dbObj - the state to populate the new instance with
        Returns:
        the new instance
      • createList

        public java.util.List createList​(MappedField mf)
        Description copied from interface: ObjectFactory
        Defines how morphia creates a List object.
        Specified by:
        createList in interface ObjectFactory
        Parameters:
        mf - the MappedField containing any metadata that might define the type of the List to create
        Returns:
        the List
      • createMap

        public java.util.Map createMap​(MappedField mf)
        Description copied from interface: ObjectFactory
        Defines how morphia creates a Map object.
        Specified by:
        createMap in interface ObjectFactory
        Parameters:
        mf - the MappedField containing any metadata that might define the type of the Map to create
        Returns:
        the Map
      • createSet

        public java.util.Set createSet​(MappedField mf)
        Description copied from interface: ObjectFactory
        Defines how morphia creates a Set object.
        Specified by:
        createSet in interface ObjectFactory
        Parameters:
        mf - the MappedField containing any metadata that might define the type of the Set to create
        Returns:
        the Set
      • getClassNameCache

        public java.util.Map<java.lang.String,​java.lang.Class> getClassNameCache()
        Returns:
        the cache of classnames