Package dev.morphia.mapping
Class MapperOptions
- java.lang.Object
-
- dev.morphia.mapping.MapperOptions
-
public class MapperOptions extends Object
Options to control mapping behavior.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MapperOptions.Builder
Deprecated, for removal: This API element is subject to removal in a future version.use the new configuration file mechanism.static class
MapperOptions.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
-
Field Summary
Fields Modifier and Type Field Description static MapperOptions
DEFAULT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
autoImportModels()
static MapperOptions.Builder
builder()
static MapperOptions.Builder
builder(MapperOptions original)
CodecProvider
codecProvider()
NamingStrategy
getCollectionNaming()
List<MorphiaConvention>
getConventions()
DateStorage
getDateStorage()
DiscriminatorFunction
getDiscriminator()
String
getDiscriminatorKey()
NamingStrategy
getFieldNaming()
Deprecated, for removal: This API element is subject to removal in a future version.usegetPropertyNaming()
insteadNamingStrategy
getPropertyNaming()
QueryFactory
getQueryFactory()
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 Morphiaboolean
isCacheClassLookups()
boolean
isEnablePolymorphicQueries()
boolean
isIgnoreFinals()
boolean
isMapSubPackages()
boolean
isStoreEmpties()
boolean
isStoreNulls()
static MapperOptions.Builder
legacy()
Deprecated.See the upgrading instructions on the website.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 vestigialString
toConfigFormat(String database, boolean showComplete)
Converts this MapperOptions instance in to the format needed for a configuration file
-
-
-
Field Detail
-
DEFAULT
public static final MapperOptions DEFAULT
-
-
Method Detail
-
builder
public static MapperOptions.Builder builder()
- Returns:
- a builder to set mapping options
-
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
-
legacy
@Deprecated public static MapperOptions.Builder legacy()
Deprecated.See the upgrading instructions on the website.- 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.
-
codecProvider
@Nullable @MorphiaInternal public CodecProvider codecProvider()
- Returns:
- the configured CodecProvider
- Since:
- 2.3
- See Also:
CodecProvider
-
getCollectionNaming
public NamingStrategy getCollectionNaming()
- Returns:
- the naming strategy for collections unless explicitly set via @Entity
- See Also:
Entity
-
getConventions
public List<MorphiaConvention> getConventions()
- Returns:
- the configured Conventions
-
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
-
getFieldNaming
@Deprecated(forRemoval=true) public NamingStrategy getFieldNaming()
Deprecated, for removal: This API element is subject to removal in a future version.usegetPropertyNaming()
instead- Returns:
- the naming strategy for properties unless explicitly set via @Property
- See Also:
Property
-
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 useshowComplete
- true if all the entries should be shown. If false, only those settings with nondefault values will be listed- Returns:
- the config file contents
-
-