public class MappedField extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
addAnnotation(Class<? extends Annotation> clazz)
Adds the annotation, if it exists on the field.
|
void |
addAnnotation(Class<? extends Annotation> clazz,
Annotation ann)
Adds the annotation, if it exists on the field.
|
static void |
addInterestingAnnotation(Class<? extends Annotation> annotation)
Adds an annotation for Morphia to retain when mapping.
|
protected void |
discover(Mapper mapper)
Discovers interesting (that we care about) things about the field.
|
protected void |
discoverType(Mapper mapper) |
<T extends Annotation> |
getAnnotation(Class<T> clazz) |
Map<Class<? extends Annotation>,Annotation> |
getAnnotations() |
Class |
getConcreteType() |
Constructor |
getCTor() |
Object |
getDbObjectValue(DBObject dbObj) |
Class |
getDeclaringClass() |
Field |
getField() |
Object |
getFieldValue(Object instance)
Gets the value of the field mapped on the instance given.
|
String |
getFirstFieldName(DBObject dbObj)
Gets the field name to use when converting from a DBObject
|
String |
getFullName() |
String |
getJavaFieldName() |
List<String> |
getLoadNames() |
Class |
getMapKeyClass()
If the underlying java type is a map then it returns T from Map
|
protected String |
getMappedFieldName() |
String |
getNameToStore() |
Class |
getSubClass()
If the java field is a list/array/map then the sub-type T is returned (ex.
|
Type |
getSubType()
If the java field is a list/array/map then the sub-type T is returned (ex.
|
Class |
getType() |
List<MappedField> |
getTypeParameters() |
boolean |
hasAnnotation(Class ann)
Indicates whether the annotation is present in the mapping (does not check the java field annotations, just the ones discovered)
|
boolean |
isArray() |
boolean |
isMap() |
boolean |
isMultipleValues() |
boolean |
isReference() |
boolean |
isSet() |
boolean |
isSingleValue() |
boolean |
isTransient() |
boolean |
isTypeMongoCompatible() |
Annotation |
putAnnotation(Annotation ann)
Adds the annotation even if not on the declared class/field.
|
void |
setFieldValue(Object instance,
Object value)
Sets the value for the java field
|
protected Class |
toClass(Type t) |
String |
toString() |
public static void addInterestingAnnotation(Class<? extends Annotation> annotation)
annotation - the type to retainpublic void addAnnotation(Class<? extends Annotation> clazz)
clazz - the annotation to addpublic void addAnnotation(Class<? extends Annotation> clazz, Annotation ann)
clazz - type of the annotationann - the annotationpublic <T extends Annotation> T getAnnotation(Class<T> clazz)
T - the type of the annotationclazz - the annotation to search forpublic Map<Class<? extends Annotation>,Annotation> getAnnotations()
public Constructor getCTor()
public Class getConcreteType()
public Object getDbObjectValue(DBObject dbObj)
dbObj - the DBObject get the value frompublic Class getDeclaringClass()
public Field getField()
public Object getFieldValue(Object instance)
instance - the instance to usepublic String getFirstFieldName(DBObject dbObj)
dbObj - the DBObject to scan for alternate namesAlsoLoadpublic String getFullName()
public String getJavaFieldName()
public List<String> getLoadNames()
public Class getMapKeyClass()
public String getNameToStore()
public Class getSubClass()
public Type getSubType()
public boolean isTransient()
public Class getType()
public List<MappedField> getTypeParameters()
public boolean hasAnnotation(Class ann)
ann - the annotation to search forpublic boolean isArray()
public boolean isMap()
public boolean isMultipleValues()
public boolean isReference()
public boolean isSet()
public boolean isSingleValue()
public boolean isTypeMongoCompatible()
public Annotation putAnnotation(Annotation ann)
ann - the annotation to addpublic void setFieldValue(Object instance, Object value)
instance - the instance to updatevalue - the value to setprotected void discover(Mapper mapper)
protected void discoverType(Mapper mapper)
protected String getMappedFieldName()