Package dev.morphia.mapping
Class Mapper
- java.lang.Object
-
- dev.morphia.mapping.Mapper
-
@Deprecated public class Mapper extends java.lang.Object
Deprecated.this class will be internalized in 2.0Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLASS_NAME_FIELDNAME
Deprecated.static java.lang.String
ID_KEY
Deprecated.use "_id" directlystatic java.lang.String
IGNORED_FIELDNAME
Deprecated.Special name that can never be used.
-
Constructor Summary
Constructors Constructor Description Mapper()
Deprecated.Creates a Mapper with default optionsMapper(MapperOptions opts)
Deprecated.Creates a Mapper with the given options.Mapper(MapperOptions options, Mapper mapper)
Deprecated.Creates a new Mapper with the given options and a Mapper to copy.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addInterceptor(EntityInterceptor ei)
Deprecated.Adds anEntityInterceptor
MappedClass
addMappedClass(java.lang.Class c)
Deprecated.Creates a MappedClass and validates it.EntityCache
createEntityCache()
Deprecated.Creates a cache for tracking entities seen during processing<T> T
fromDb(Datastore datastore, com.mongodb.DBObject dbObject, T entity, EntityCache cache)
Deprecated.no replacement is planned<T> T
fromDBObject(Datastore datastore, java.lang.Class<T> entityClass, com.mongodb.DBObject dbObject, EntityCache cache)
Deprecated.no replacement is plannedjava.lang.Class<?>
getClassFromCollection(java.lang.String collection)
Deprecated.no replacement is plannedjava.lang.String
getCollectionName(java.lang.Object object)
Deprecated.no replacement is plannedConverters
getConverters()
Deprecated.java.lang.Object
getId(java.lang.Object entity)
Deprecated.Gets the ID value for an entityjava.util.Map<java.lang.Class,java.lang.Object>
getInstanceCache()
Deprecated.no replacement is plannedjava.util.Collection<EntityInterceptor>
getInterceptors()
Deprecated.Gets list ofEntityInterceptor
s<T> Key<T>
getKey(T entity)
Deprecated.Gets the Key for an entity<T> Key<T>
getKey(T entity, java.lang.String collection)
Deprecated.Gets the Key for an entity and a specific collection<T> java.util.List<Key<T>>
getKeysByManualRefs(java.lang.Class<T> clazz, java.util.List<java.lang.Object> refs)
Deprecated.Gets the Keys for a list of objects<T> java.util.List<Key<T>>
getKeysByRefs(java.util.List<com.mongodb.DBRef> refs)
Deprecated.Gets the Keys for a list of objectsMappedClass
getMappedClass(java.lang.Object obj)
Deprecated.Gets theMappedClass
for the object (type).java.util.Collection<MappedClass>
getMappedClasses()
Deprecated.java.util.Map<java.lang.String,MappedClass>
getMCMap()
Deprecated.MapperOptions
getOptions()
Deprecated.protected LazyProxyFactory
getProxyFactory()
Deprecated.java.util.List<MappedClass>
getSubTypes(MappedClass mc)
Deprecated.Finds any subtypes for the given MappedClass.boolean
isMapped(java.lang.Class c)
Deprecated.Checks to see if a Class has been mapped.com.mongodb.DBRef
keyToDBRef(Key key)
Deprecated.Converts a Key to a DBRef<T> Key<T>
manualRefToKey(java.lang.Class<T> type, java.lang.Object id)
Deprecated.Creates a Key for a type and an ID value<T> Key<T>
refToKey(com.mongodb.DBRef ref)
Deprecated.Converts a DBRef to a Keyvoid
setOptions(MapperOptions options)
Deprecated.Sets the options this Mapper should usecom.mongodb.DBObject
toDBObject(java.lang.Object entity)
Deprecated./** Converts an entity (POJO) to a DBObject.com.mongodb.DBObject
toDBObject(java.lang.Object entity, java.util.Map<java.lang.Object,com.mongodb.DBObject> involvedObjects)
Deprecated.Converts an entity (POJO) to a DBObject.java.lang.Object
toMongoObject(MappedField mf, MappedClass mc, java.lang.Object value)
Deprecated.Converts a java object to a mongo-compatible object (possibly a DBObject for complex mappings).java.lang.String
updateCollection(Key key)
Deprecated.Updates the collection value on a Key with the mapped value on the Key's type Classvoid
updateKeyAndVersionInfo(Datastore datastore, com.mongodb.DBObject dbObj, EntityCache cache, java.lang.Object entity)
Deprecated.
-
-
-
Field Detail
-
ID_KEY
@Deprecated public static final java.lang.String ID_KEY
Deprecated.use "_id" directlyThe @Id
field name that is stored with mongodb.- See Also:
- Constant Field Values
-
IGNORED_FIELDNAME
public static final java.lang.String IGNORED_FIELDNAME
Deprecated.Special name that can never be used. Used as default for some fields to indicate default state.- See Also:
- Constant Field Values
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
CLASS_NAME_FIELDNAME
@Deprecated public static final java.lang.String CLASS_NAME_FIELDNAME
Deprecated.Special field used by morphia to support various possibly loading issues; will be replaced when discriminators are implemented to support polymorphism- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Mapper
public Mapper(MapperOptions opts)
Deprecated.Creates a Mapper with the given options.- Parameters:
opts
- the options to use
-
Mapper
public Mapper()
Deprecated.Creates a Mapper with default options- See Also:
MapperOptions
-
Mapper
public Mapper(MapperOptions options, Mapper mapper)
Deprecated.Creates a new Mapper with the given options and a Mapper to copy. This is effectively a copy constructor that allows a developer to override the options.- Parameters:
options
- the options to usemapper
- the collection of MappedClasses to add
-
-
Method Detail
-
addInterceptor
public void addInterceptor(EntityInterceptor ei)
Deprecated.Adds anEntityInterceptor
- Parameters:
ei
- the interceptor to add
-
addMappedClass
public MappedClass addMappedClass(java.lang.Class c)
Deprecated.Creates a MappedClass and validates it.- Parameters:
c
- the Class to map- Returns:
- the MappedClass for the given Class
-
createEntityCache
public EntityCache createEntityCache()
Deprecated.Creates a cache for tracking entities seen during processing- Returns:
- the cache
-
fromDBObject
@Deprecated public <T> T fromDBObject(Datastore datastore, java.lang.Class<T> entityClass, com.mongodb.DBObject dbObject, EntityCache cache)
Deprecated.no replacement is plannedConverts a DBObject back to a type-safe java object (POJO)- Type Parameters:
T
- the type of the entity- Parameters:
datastore
- the Datastore to use when fetching this referenceentityClass
- The type to return, or use; can be overridden by the @see Mapper.CLASS_NAME_FIELDNAME in the DBObjectdbObject
- the DBObject containing the document from mongodbcache
- the EntityCache to use- Returns:
- the new entity
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getSubTypes
public java.util.List<MappedClass> getSubTypes(MappedClass mc)
Deprecated.Finds any subtypes for the given MappedClass.- Parameters:
mc
- the parent type- Returns:
- the list of subtypes
- Since:
- 1.3
-
fromDb
@Deprecated public <T> T fromDb(Datastore datastore, com.mongodb.DBObject dbObject, T entity, EntityCache cache)
Deprecated.no replacement is plannedConverts a DBObject back to a type-safe java object (POJO)- Type Parameters:
T
- the type of the entity- Parameters:
datastore
- the Datastore to use when fetching this referencedbObject
- the DBObject containing the document from mongodbentity
- the instance to populatecache
- the EntityCache to use- Returns:
- the entity
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getClassFromCollection
@Deprecated public java.lang.Class<?> getClassFromCollection(java.lang.String collection)
Deprecated.no replacement is plannedLooks up the class mapped to a named collection.- Parameters:
collection
- the collection name- Returns:
- the Class mapped to this collection name
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getCollectionName
@Deprecated public java.lang.String getCollectionName(java.lang.Object object)
Deprecated.no replacement is plannedGets the mapped collection for an object instance or Class reference.- Parameters:
object
- the object to process- Returns:
- the collection name
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getConverters
public Converters getConverters()
Deprecated.- Returns:
- the Converters bundle this Mapper uses
-
getId
public java.lang.Object getId(java.lang.Object entity)
Deprecated.Gets the ID value for an entity- Parameters:
entity
- the entity to process- Returns:
- the ID value
-
getInstanceCache
public java.util.Map<java.lang.Class,java.lang.Object> getInstanceCache()
Deprecated.no replacement is planned- Returns:
- the cache of instances
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getInterceptors
public java.util.Collection<EntityInterceptor> getInterceptors()
Deprecated.Gets list ofEntityInterceptor
s- Returns:
- the Interceptors
-
getKey
public <T> Key<T> getKey(T entity)
Deprecated.Gets the Key for an entity- Type Parameters:
T
- the type of the entity- Parameters:
entity
- the entity to process- Returns:
- the Key
-
getKey
public <T> Key<T> getKey(T entity, java.lang.String collection)
Deprecated.Gets the Key for an entity and a specific collection- Type Parameters:
T
- the type of the entity- Parameters:
entity
- the entity to processcollection
- the collection to use in the Key rather than the mapped collection as defined on the entity's class- Returns:
- the Key
-
getKeysByManualRefs
public <T> java.util.List<Key<T>> getKeysByManualRefs(java.lang.Class<T> clazz, java.util.List<java.lang.Object> refs)
Deprecated.Gets the Keys for a list of objects- Type Parameters:
T
- the type of the entity- Parameters:
clazz
- the Class of the objectsrefs
- the objects to fetch the keys for- Returns:
- the list of Keys
-
getKeysByRefs
public <T> java.util.List<Key<T>> getKeysByRefs(java.util.List<com.mongodb.DBRef> refs)
Deprecated.Gets the Keys for a list of objects- Type Parameters:
T
- the type of the objects- Parameters:
refs
- the objects to process- Returns:
- the list of Keys
-
getMCMap
public java.util.Map<java.lang.String,MappedClass> getMCMap()
Deprecated.- Returns:
- map of MappedClasses by class name
-
getMappedClass
public MappedClass getMappedClass(java.lang.Object obj)
Deprecated.Gets theMappedClass
for the object (type). If it isn't mapped, create a new class and cache it (without validating).- Parameters:
obj
- the object to process- Returns:
- the MappedClass for the object given
-
getMappedClasses
public java.util.Collection<MappedClass> getMappedClasses()
Deprecated.- Returns:
- collection of MappedClasses
-
getOptions
public MapperOptions getOptions()
Deprecated.- Returns:
- the options used by this Mapper
-
setOptions
public void setOptions(MapperOptions options)
Deprecated.Sets the options this Mapper should use- Parameters:
options
- the options to use
-
isMapped
public boolean isMapped(java.lang.Class c)
Deprecated.Checks to see if a Class has been mapped.- Parameters:
c
- the Class to check- Returns:
- true if the Class has been mapped
-
keyToDBRef
public com.mongodb.DBRef keyToDBRef(Key key)
Deprecated.Converts a Key to a DBRef- Parameters:
key
- the Key to convert- Returns:
- the DBRef
-
manualRefToKey
public <T> Key<T> manualRefToKey(java.lang.Class<T> type, java.lang.Object id)
Deprecated.Creates a Key for a type and an ID value- Type Parameters:
T
- the type of the entity- Parameters:
type
- the Class of the entityid
- the ID value- Returns:
- the Key
-
refToKey
public <T> Key<T> refToKey(com.mongodb.DBRef ref)
Deprecated.Converts a DBRef to a Key- Type Parameters:
T
- the type of the referenced entity- Parameters:
ref
- the DBRef to convert- Returns:
- the Key
-
toDBObject
public com.mongodb.DBObject toDBObject(java.lang.Object entity)
Deprecated./** Converts an entity (POJO) to a DBObject. A special field will be added to keep track of the class type.- Parameters:
entity
- The POJO- Returns:
- the DBObject
-
toDBObject
public com.mongodb.DBObject toDBObject(java.lang.Object entity, java.util.Map<java.lang.Object,com.mongodb.DBObject> involvedObjects)
Deprecated.Converts an entity (POJO) to a DBObject. A special field will be added to keep track of the class type.- Parameters:
entity
- The POJOinvolvedObjects
- A Map of (already converted) POJOs- Returns:
- the DBObject
-
toMongoObject
public java.lang.Object toMongoObject(MappedField mf, MappedClass mc, java.lang.Object value)
Deprecated.Converts a java object to a mongo-compatible object (possibly a DBObject for complex mappings). Very similar totoDBObject(java.lang.Object)
. Used (mainly) by query/update operations.- Parameters:
mf
- the MappedField for this valuemc
- the MappedClass for this valuevalue
- the value to convert- Returns:
- the MongoDB compatible object
-
updateCollection
public java.lang.String updateCollection(Key key)
Deprecated.Updates the collection value on a Key with the mapped value on the Key's type Class- Parameters:
key
- the Key to update- Returns:
- the collection name on the Key
-
updateKeyAndVersionInfo
public void updateKeyAndVersionInfo(Datastore datastore, com.mongodb.DBObject dbObj, EntityCache cache, java.lang.Object entity)
Deprecated.- Parameters:
datastore
- the Datastore to use when fetching this referencedbObj
- Value to update with; null means skipcache
- the EntityCacheentity
- The object to update
-
getProxyFactory
protected LazyProxyFactory getProxyFactory()
Deprecated.
-
-