Package dev.morphia.mapping
Class MappedField
- java.lang.Object
-
- dev.morphia.mapping.MappedField
-
- Direct Known Subclasses:
EphemeralMappedField
public class MappedField extends java.lang.ObjectDeprecated.Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)Deprecated.Adds the annotation, if it exists on the field.voidaddAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz, java.lang.annotation.Annotation ann)Deprecated.Adds the annotation, if it exists on the field.static voidaddInterestingAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)Deprecated.Adds an annotation for Morphia to retain when mapping.protected voiddiscover(Mapper mapper)Deprecated.Discovers interesting (that we care about) things about the field.protected voiddiscoverType(Mapper mapper)Deprecated.<T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> clazz)Deprecated.java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation>getAnnotations()Deprecated.java.lang.ClassgetConcreteType()Deprecated.java.lang.reflect.ConstructorgetCTor()Deprecated.java.lang.ObjectgetDbObjectValue(com.mongodb.DBObject dbObj)Deprecated.java.lang.ClassgetDeclaringClass()Deprecated.java.lang.reflect.FieldgetField()Deprecated.java.lang.ObjectgetFieldValue(java.lang.Object instance)Deprecated.Gets the value of the field mapped on the instance given.java.lang.StringgetFirstFieldName(com.mongodb.DBObject dbObj)Deprecated.Gets the field name to use when converting from a DBObjectjava.lang.StringgetFullName()Deprecated.java.lang.StringgetJavaFieldName()Deprecated.java.util.List<java.lang.String>getLoadNames()Deprecated.java.lang.ClassgetMapKeyClass()Deprecated.If the underlying java type is a map then it returns T from Map<T,V>java.lang.StringgetMappedFieldName()Deprecated.java.lang.StringgetNameToStore()Deprecated.java.lang.ClassgetSubClass()Deprecated.If the java field is a list/array/map then the sub-type T is returned (ex.java.lang.reflect.TypegetSubType()Deprecated.If the java field is a list/array/map then the sub-type T is returned (ex.java.lang.ClassgetType()Deprecated.java.util.List<MappedField>getTypeParameters()Deprecated.booleanhasAnnotation(java.lang.Class ann)Deprecated.Indicates whether the annotation is present in the mapping (does not check the java field annotations, just the ones discovered)protected java.util.List<java.lang.String>inferLoadNames()Deprecated.booleanisArray()Deprecated.booleanisMap()Deprecated.booleanisMultipleValues()Deprecated.booleanisReference()Deprecated.booleanisSet()Deprecated.booleanisSingleValue()Deprecated.booleanisTransient()Deprecated.booleanisTypeMongoCompatible()Deprecated.java.lang.annotation.AnnotationputAnnotation(java.lang.annotation.Annotation ann)Deprecated.unusedvoidsetFieldValue(java.lang.Object instance, java.lang.Object value)Deprecated.Sets the value for the java fieldprotected java.lang.ClasstoClass(java.lang.reflect.Type t)Deprecated.java.lang.StringtoString()Deprecated.
-
-
-
Method Detail
-
addInterestingAnnotation
public static void addInterestingAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Deprecated.Adds an annotation for Morphia to retain when mapping.- Parameters:
annotation- the type to retain
-
addAnnotation
public void addAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
Deprecated.Adds the annotation, if it exists on the field.- Parameters:
clazz- the annotation to add
-
addAnnotation
public void addAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> clazz, java.lang.annotation.Annotation ann)Deprecated.Adds the annotation, if it exists on the field.- Parameters:
clazz- type of the annotationann- the annotation
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> clazz)
Deprecated.- Type Parameters:
T- the type of the annotation- Parameters:
clazz- the annotation to search for- Returns:
- the annotation instance if it exists on this field
-
getAnnotations
public java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> getAnnotations()
Deprecated.- Returns:
- the annotations found while mapping
-
getCTor
public java.lang.reflect.Constructor getCTor()
Deprecated.- Returns:
- a constructor for the type represented by the field
-
getConcreteType
public java.lang.Class getConcreteType()
Deprecated.- Returns:
- the concrete type of the MappedField
-
getDbObjectValue
public java.lang.Object getDbObjectValue(com.mongodb.DBObject dbObj)
Deprecated.- Parameters:
dbObj- the DBObject get the value from- Returns:
- the value from best mapping of this field
-
getDeclaringClass
public java.lang.Class getDeclaringClass()
Deprecated.- Returns:
- the declaring class of the java field
-
getField
public java.lang.reflect.Field getField()
Deprecated.- Returns:
- the underlying java field
-
getFieldValue
public java.lang.Object getFieldValue(java.lang.Object instance)
Deprecated.Gets the value of the field mapped on the instance given.- Parameters:
instance- the instance to use- Returns:
- the value stored in the java field
-
getFirstFieldName
public java.lang.String getFirstFieldName(com.mongodb.DBObject dbObj)
Deprecated.Gets the field name to use when converting from a DBObject- Parameters:
dbObj- the DBObject to scan for alternate names- Returns:
- the value of this field mapped from the DBObject
- See Also:
AlsoLoad
-
getFullName
public java.lang.String getFullName()
Deprecated.- Returns:
- the full name of the class plus java field name
-
getJavaFieldName
public java.lang.String getJavaFieldName()
Deprecated.- Returns:
- the name of the java field, as declared on the class
-
getLoadNames
public java.util.List<java.lang.String> getLoadNames()
Deprecated.- Returns:
- the name of the field's (key)name for mongodb, in order of loading.
-
inferLoadNames
protected java.util.List<java.lang.String> inferLoadNames()
Deprecated.
-
getMapKeyClass
public java.lang.Class getMapKeyClass()
Deprecated.If the underlying java type is a map then it returns T from Map<T,V>- Returns:
- the type of the map key
-
getNameToStore
public java.lang.String getNameToStore()
Deprecated.- Returns:
- the name of the field's (key)name for mongodb
-
getSubClass
public java.lang.Class getSubClass()
Deprecated.If the java field is a list/array/map then the sub-type T is returned (ex. List<T>, T[], Map<?,T>- Returns:
- the parameterized type of the field
-
getSubType
public java.lang.reflect.Type getSubType()
Deprecated.If the java field is a list/array/map then the sub-type T is returned (ex. List<T>, T[], Map<?,T>- Returns:
- the parameterized type of the field
-
isTransient
public boolean isTransient()
Deprecated.- Returns:
- true if this field is marked as transient
-
getType
public java.lang.Class getType()
Deprecated.- Returns:
- the type of the underlying java field
-
getTypeParameters
public java.util.List<MappedField> getTypeParameters()
Deprecated.- Returns:
- the type parameters defined on the field
-
hasAnnotation
public boolean hasAnnotation(java.lang.Class ann)
Deprecated.Indicates whether the annotation is present in the mapping (does not check the java field annotations, just the ones discovered)- Parameters:
ann- the annotation to search for- Returns:
- true if the annotation was found
-
isArray
public boolean isArray()
Deprecated.- Returns:
- true if the MappedField is an array
-
isMap
public boolean isMap()
Deprecated.- Returns:
- true if the MappedField is a Map
-
isMultipleValues
public boolean isMultipleValues()
Deprecated.- Returns:
- true if this field is a container type such as a List, Map, Set, or array
-
isReference
public boolean isReference()
Deprecated.
-
isSet
public boolean isSet()
Deprecated.- Returns:
- true if the MappedField is a Set
-
isSingleValue
public boolean isSingleValue()
Deprecated.- Returns:
- true if this field is not a container type such as a List, Map, Set, or array
-
isTypeMongoCompatible
public boolean isTypeMongoCompatible()
Deprecated.- Returns:
- true if type is understood by MongoDB and the driver
-
putAnnotation
@Deprecated public java.lang.annotation.Annotation putAnnotation(java.lang.annotation.Annotation ann)
Deprecated.unusedAdds the annotation even if not on the declared class/field.- Parameters:
ann- the annotation to add- Returns:
- ann the annotation
-
setFieldValue
public void setFieldValue(java.lang.Object instance, java.lang.Object value)Deprecated.Sets the value for the java field- Parameters:
instance- the instance to updatevalue- the value to set
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toStringin classjava.lang.Object
-
discover
protected void discover(Mapper mapper)
Deprecated.Discovers interesting (that we care about) things about the field.
-
discoverType
protected void discoverType(Mapper mapper)
Deprecated.
-
getMappedFieldName
public java.lang.String getMappedFieldName()
Deprecated.- Returns:
- the name of the field's key-name for mongodb
Developer note. This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
toClass
protected java.lang.Class toClass(java.lang.reflect.Type t)
Deprecated.
-
-