Package dev.morphia.mapping
Class MapperOptions
- java.lang.Object
-
- dev.morphia.mapping.MapperOptions
-
public class MapperOptions extends java.lang.Object
Options to control mapping behavior.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MapperOptions.Builder
A builder class for setting mapping options
-
Constructor Summary
Constructors Constructor Description MapperOptions()
Deprecated.use the Builder insteadMapperOptions(MapperOptions options)
Deprecated.use the Builder instead
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static MapperOptions.Builder
builder()
Deprecated.continued use of this method will result in different options being applied in 2.0.static MapperOptions.Builder
builder(MapperOptions original)
EntityCacheFactory
getCacheFactory()
java.lang.ClassLoader
getClassLoader()
Returns the classloader used, in theory, when loading the entity types.DatastoreProvider
getDatastoreProvider()
Deprecated.unusedDateStorage
getDateStorage()
CustomMapper
getDefaultMapper()
java.lang.String
getDiscriminatorField()
CustomMapper
getEmbeddedMapper()
ObjectFactory
getObjectFactory()
CustomMapper
getReferenceMapper()
CustomMapper
getValueMapper()
boolean
isActLikeSerializer()
Deprecated.this is actually the default and proper behavior.boolean
isCacheClassLookups()
boolean
isCachingEnabled()
boolean
isDisableEmbeddedIndexes()
boolean
isIgnoreFinals()
boolean
isMapSubPackages()
boolean
isStoreEmpties()
boolean
isStoreNulls()
boolean
isUseLowerCaseCollectionNames()
static MapperOptions.Builder
legacy()
void
setActLikeSerializer(boolean ignored)
Deprecated.this is actually the default and proper behavior.void
setCacheClassLookups(boolean cacheClassLookups)
Deprecated.use the Builder insteadvoid
setCacheFactory(EntityCacheFactory cacheFactory)
Deprecated.use the Builder insteadMapperOptions
setCachingEnabled(boolean enabled)
void
setDatastoreProvider(DatastoreProvider unused)
Deprecated.unusedvoid
setDateStorage(DateStorage dateStorage)
Deprecated.This will be removed in 2.0.void
setDefaultMapper(CustomMapper pDefaultMapper)
Deprecated.use the Builder insteadvoid
setDisableEmbeddedIndexes(boolean disableEmbeddedIndexes)
Disables indexing of embedded typesvoid
setEmbeddedMapper(CustomMapper pEmbeddedMapper)
Deprecated.use the Builder insteadvoid
setIgnoreFinals(boolean ignoreFinals)
Deprecated.use the Builder insteadvoid
setMapSubPackages(boolean mapSubPackages)
Deprecated.use the Builder insteadvoid
setObjectFactory(ObjectFactory objectFactory)
Deprecated.use the Builder insteadvoid
setReferenceMapper(CustomMapper pReferenceMapper)
Deprecated.use the Builder insteadvoid
setStoreEmpties(boolean storeEmpties)
Deprecated.use the Builder insteadvoid
setStoreNulls(boolean storeNulls)
Deprecated.use the Builder insteadvoid
setUseLowerCaseCollectionNames(boolean useLowerCaseCollectionNames)
Deprecated.use the Builder insteadvoid
setValueMapper(CustomMapper pValueMapper)
Deprecated.use the Builder instead
-
-
-
Constructor Detail
-
MapperOptions
@Deprecated public MapperOptions()
Deprecated.use the Builder insteadCreates a default options instance.- See Also:
builder()
,MapperOptions.Builder
-
MapperOptions
@Deprecated public MapperOptions(MapperOptions options)
Deprecated.use the Builder insteadCopy Constructor- Parameters:
options
- the MapperOptions to copy- See Also:
builder(MapperOptions)
,MapperOptions.Builder
-
-
Method Detail
-
getCacheFactory
public EntityCacheFactory getCacheFactory()
- Returns:
- the factory to create an EntityCache
-
setCacheFactory
@Deprecated public void setCacheFactory(EntityCacheFactory cacheFactory)
Deprecated.use the Builder insteadSets 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.unusedSets 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 insteadSets 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 insteadSets 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 insteadSets 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 insteadSets 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 insteadSets 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 redundantInstructs 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 insteadSets 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 insteadControls 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 insteadControls 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 insteadControls 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 insteadControls 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 insteadControls 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 isDateStorage.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 uselegacy()
instead.- Returns:
- a builder to set mapping options
- See Also:
legacy()
-
legacy
public static MapperOptions.Builder legacy()
- 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
-
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.
-
-