Class MapperOptions

  • java.lang.Object
    • dev.morphia.mapping.MapperOptions

  • public class MapperOptions
    extends java.lang.Object
    Options to control mapping behavior.
    • Method Detail

      • getCacheFactory

        public EntityCacheFactory getCacheFactory()
        Returns:
        the factory to create an EntityCache
      • setCacheFactory

        @Deprecated
        public void setCacheFactory​(EntityCacheFactory cacheFactory)
        Deprecated.
        use the Builder instead
        Sets the factory to create an EntityCache
        Parameters:
        cacheFactory - the factory
        See Also:
        MapperOptions.Builder
      • getDatastoreProvider

        @Deprecated
        public DatastoreProvider getDatastoreProvider()
        Deprecated.
        unused
        Returns:
        the DatastoreProvider Morphia should use
      • setDatastoreProvider

        @Deprecated
        public void setDatastoreProvider​(DatastoreProvider unused)
        Deprecated.
        unused
        Sets the DatastoreProvider Morphia should use
        Parameters:
        unused - the DatastoreProvider to use
      • getDefaultMapper

        public CustomMapper getDefaultMapper()
        Returns:
        the mapper to use for top level entities
      • setDefaultMapper

        @Deprecated
        public void setDefaultMapper​(CustomMapper pDefaultMapper)
        Deprecated.
        use the Builder instead
        Sets the mapper to use for top level entities
        Parameters:
        pDefaultMapper - the mapper to use
        See Also:
        MapperOptions.Builder
      • getEmbeddedMapper

        public CustomMapper getEmbeddedMapper()
        Returns:
        the mapper to use for embedded entities
      • setEmbeddedMapper

        @Deprecated
        public void setEmbeddedMapper​(CustomMapper pEmbeddedMapper)
        Deprecated.
        use the Builder instead
        Sets the mapper to use for embedded entities
        Parameters:
        pEmbeddedMapper - the mapper to use
        See Also:
        MapperOptions.Builder
      • getObjectFactory

        public ObjectFactory getObjectFactory()
        Returns:
        the factory to use when creating new instances
      • setObjectFactory

        @Deprecated
        public void setObjectFactory​(ObjectFactory objectFactory)
        Deprecated.
        use the Builder instead
        Sets the ObjectFactory to use when instantiating entity classes. The default factory is a simple reflection based factory but this could be used, e.g., to provide a Guice-based factory such as what morphia-guice provides.
        Parameters:
        objectFactory - the factory to use
        See Also:
        MapperOptions.Builder
      • getReferenceMapper

        public CustomMapper getReferenceMapper()
        Returns:
        the mapper to use for references
        See Also:
        Reference
      • setReferenceMapper

        @Deprecated
        public void setReferenceMapper​(CustomMapper pReferenceMapper)
        Deprecated.
        use the Builder instead
        Sets the mapper to use for references
        Parameters:
        pReferenceMapper - the mapper to use
        See Also:
        Reference, MapperOptions.Builder
      • getValueMapper

        public CustomMapper getValueMapper()
        Returns:
        the mapper to use when processing values
      • setValueMapper

        @Deprecated
        public void setValueMapper​(CustomMapper pValueMapper)
        Deprecated.
        use the Builder instead
        Sets the mapper to use when processing values
        Parameters:
        pValueMapper - the mapper to use
        See Also:
        MapperOptions.Builder
      • isActLikeSerializer

        @Deprecated
        public boolean isActLikeSerializer()
        Deprecated.
        this is actually the default and proper behavior. this setting is redundant
        Returns:
        true if Morphia should ignore transient fields
      • setActLikeSerializer

        @Deprecated
        public void setActLikeSerializer​(boolean ignored)
        Deprecated.
        this is actually the default and proper behavior. this setting is redundant
        Instructs Morphia to follow JDK serialization semantics and ignore values marked up with the transient keyword
        Parameters:
        ignored - true if Morphia should ignore transient fields
      • isCachingEnabled

        public boolean isCachingEnabled()
        Returns:
        true if Morphia should cache entities on lookups
      • setCachingEnabled

        public MapperOptions setCachingEnabled​(boolean enabled)
        Parameters:
        enabled - true if Morphia should cache entities on lookups
        Returns:
        this
      • isCacheClassLookups

        public boolean isCacheClassLookups()
        Returns:
        true if Morphia should cache name to Class lookups
      • setCacheClassLookups

        @Deprecated
        public void setCacheClassLookups​(boolean cacheClassLookups)
        Deprecated.
        use the Builder instead
        Sets whether Morphia should cache name to Class lookups
        Parameters:
        cacheClassLookups - true if the lookup results should be cached
        See Also:
        MapperOptions.Builder
      • isIgnoreFinals

        public boolean isIgnoreFinals()
        Returns:
        true if Morphia should ignore final fields
      • setIgnoreFinals

        @Deprecated
        public void setIgnoreFinals​(boolean ignoreFinals)
        Deprecated.
        use the Builder instead
        Controls if final fields are stored.
        Parameters:
        ignoreFinals - true if Morphia should ignore final fields
        See Also:
        MapperOptions.Builder
      • isStoreEmpties

        public boolean isStoreEmpties()
        Returns:
        true if Morphia should store empty values for lists/maps/sets/arrays
      • setStoreEmpties

        @Deprecated
        public void setStoreEmpties​(boolean storeEmpties)
        Deprecated.
        use the Builder instead
        Controls if Morphia should store empty values for lists/maps/sets/arrays
        Parameters:
        storeEmpties - true if Morphia should store empty values for lists/maps/sets/arrays
        See Also:
        MapperOptions.Builder
      • isStoreNulls

        public boolean isStoreNulls()
        Returns:
        true if Morphia should store null values
      • setStoreNulls

        @Deprecated
        public void setStoreNulls​(boolean storeNulls)
        Deprecated.
        use the Builder instead
        Controls if null are stored.
        Parameters:
        storeNulls - true if Morphia should store null values
        See Also:
        MapperOptions.Builder
      • isUseLowerCaseCollectionNames

        public boolean isUseLowerCaseCollectionNames()
        Returns:
        true if Morphia should use lower case values when calculating collection names
      • setUseLowerCaseCollectionNames

        @Deprecated
        public void setUseLowerCaseCollectionNames​(boolean useLowerCaseCollectionNames)
        Deprecated.
        use the Builder instead
        Controls if default entity collection name should be lowercase.
        Parameters:
        useLowerCaseCollectionNames - true if Morphia should use lower case values when calculating collection names
        See Also:
        MapperOptions.Builder
      • isDisableEmbeddedIndexes

        public boolean isDisableEmbeddedIndexes()
        Returns:
        true if Morphia should skip scanning @Embedded fields for index definitions.
        Since:
        1.5
      • isMapSubPackages

        public boolean isMapSubPackages()
        Returns:
        true if Morphia should map classes from the sub-packages as well
      • setMapSubPackages

        @Deprecated
        public void setMapSubPackages​(boolean mapSubPackages)
        Deprecated.
        use the Builder instead
        Controls if classes from sub-packages should be mapped.
        Parameters:
        mapSubPackages - true if Morphia should map classes from the sub-packages as well
        See Also:
        MapperOptions.Builder
      • getDiscriminatorField

        public java.lang.String getDiscriminatorField()
        Returns:
        the discriminator field name
      • setDisableEmbeddedIndexes

        public void setDisableEmbeddedIndexes​(boolean disableEmbeddedIndexes)
        Disables indexing of embedded types
        Parameters:
        disableEmbeddedIndexes - if true, @Embedded fields will not be scanned for indexing
      • getDateStorage

        public DateStorage getDateStorage()
        Returns:
        the format to use for Java 8 date/time storage
      • setDateStorage

        @Deprecated
        public void setDateStorage​(DateStorage dateStorage)
        Deprecated.
        This will be removed in 2.0. It is intended to bridge the gap when correcting the storage of data/time values in the database. DateStorage.UTC should be used and will be the default in 2.0. In 1.5 it is DateStorage.SYSTEM_DEFAULT for backwards compatibility.
        This is used to determine how Java 8 dates and times are stored in the database.
        Parameters:
        dateStorage - the storage scheme to use for dates
      • builder

        @Deprecated
        public static MapperOptions.Builder builder()
        Deprecated.
        continued use of this method will result in different options being applied in 2.0. To maintain the current settings please use legacy() instead.
        Returns:
        a builder to set mapping options
        See Also:
        legacy()
      • builder

        public static MapperOptions.Builder builder​(MapperOptions original)
        Parameters:
        original - an existing set of options to use as a starting point
        Returns:
        a builder to set mapping options
      • getClassLoader

        public java.lang.ClassLoader getClassLoader()
        Returns the classloader used, in theory, when loading the entity types.
        Returns:
        the classloader
        Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.