Class MapperOptions


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

      • 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
      • autoImportModels

        @MorphiaInternal
        public boolean autoImportModels()
        Returns:
        true if EntityModelImporter instances should be loaded
        Since:
        2.3
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • getCollectionNaming

        public NamingStrategy getCollectionNaming()
        Returns:
        the naming strategy for collections unless explicitly set via @Entity
        See Also:
        Entity
      • getDateStorage

        public DateStorage getDateStorage()
        Returns:
        the date storage configuration value
      • getDiscriminator

        public DiscriminatorFunction getDiscriminator()
        Returns:
        the function to determine discriminator value
      • getDiscriminatorKey

        public String getDiscriminatorKey()
        Returns:
        the discriminator property name
      • getPropertyNaming

        public NamingStrategy getPropertyNaming()
        Returns:
        the naming strategy for properties unless explicitly set via @Property
        Since:
        2.2
        See Also:
        Property
      • getQueryFactory

        public QueryFactory getQueryFactory()
        Returns:
        the query factory used by the Datastore
        Since:
        2.0
      • getUuidRepresentation

        @Deprecated(forRemoval=true,
                    since="2.3")
        public UuidRepresentation getUuidRepresentation()
        Deprecated, for removal: This API element is subject to removal in a future version.
        This should be configured in the MongoClient given to Morphia
        Returns:
        the UUID representation to use in the driver
      • isCacheClassLookups

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

        public boolean isEnablePolymorphicQueries()
        Returns:
        true if polymorphic queries are enabled
      • isIgnoreFinals

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

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

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

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

        @Deprecated(since="2.4",
                    forRemoval=true)
        public MapperOptions.PropertyDiscovery propertyDiscovery()
        Deprecated, for removal: This API element is subject to removal in a future version.
        3.0 will evaluate both field and getter/setters for annotation so this setting becomes vestigial
        Returns:
        Since:
        2.4
      • toConfigFormat

        public String toConfigFormat​(String database,
                                     boolean showComplete)
        Converts this MapperOptions instance in to the format needed for a configuration file
        Parameters:
        database - the database name to use
        showComplete - true if all the entries should be shown. If false, only those settings with nondefault values will be listed
        Returns:
        the config file contents