public class MappedClass extends Object
| Constructor and Description |
|---|
MappedClass(Class<?> clazz,
Mapper mapper)
Creates a MappedClass instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAnnotation(Class<? extends Annotation> clazz,
Annotation ann)
Adds the given Annotation to the internal list for the given Class.
|
static void |
addInterestingAnnotation(Class<? extends Annotation> annotation)
Adds an annotation for Morphia to retain when mapping.
|
protected void |
basicValidate() |
DBObject |
callLifecycleMethods(Class<? extends Annotation> event,
Object entity,
DBObject dbObj,
Mapper mapper)
Call the lifecycle methods
|
boolean |
containsJavaFieldName(String name)
Check java field name that will be stored in mongodb
|
protected void |
discover(Mapper mapper)
Discovers interesting (that we care about) things about the class.
|
boolean |
equals(Object o) |
Annotation |
getAnnotation(Class<? extends Annotation> clazz)
Looks for an annotation of the type given
|
<T> List<T> |
getAnnotations(Class<? extends Annotation> clazz)
Looks for an annotation in the annotations found on a class while mapping
|
Class<?> |
getClazz() |
String |
getCollectionName() |
Embedded |
getEmbeddedAnnotation() |
Entity |
getEntityAnnotation() |
List<MappedField> |
getFieldsAnnotatedWith(Class<? extends Annotation> clazz)
Returns fields annotated with the clazz
|
Annotation |
getFirstAnnotation(Class<? extends Annotation> clazz)
Returns the first found Annotation, or null.
|
Field |
getIdField() |
List<org.mongodb.morphia.mapping.MappedClass.ClassMethodPair> |
getLifecycleMethods(Class<Annotation> clazz)
Gets the lifecycle methods for particular annotation.
|
MappedField |
getMappedField(String storedName)
Returns the MappedField by the name that it will stored in mongodb as
|
MappedField |
getMappedFieldByJavaField(String name)
Returns MappedField for a given java field name on the this MappedClass
|
MappedField |
getMappedIdField() |
MappedField |
getMappedVersionField() |
List<MappedField> |
getPersistenceFields() |
Map<Class<? extends Annotation>,List<Annotation>> |
getRelevantAnnotations() |
int |
hashCode() |
boolean |
isInterface() |
static boolean |
isSupportedType(Class<?> clazz)
Checks to see if it a Map/Set/List or a property supported by the MongoDB java driver
|
String |
toString() |
void |
update()
Update mappings based on fields/annotations.
|
void |
validate(Mapper mapper)
Validates this MappedClass
|
public boolean isInterface()
public static boolean isSupportedType(Class<?> clazz)
clazz - the type to checkpublic static void addInterestingAnnotation(Class<? extends Annotation> annotation)
annotation - the type to retainpublic void addAnnotation(Class<? extends Annotation> clazz, Annotation ann)
clazz - the type to addann - the annotation to addpublic DBObject callLifecycleMethods(Class<? extends Annotation> event, Object entity, DBObject dbObj, Mapper mapper)
event - the lifecycle annotationentity - the entity to processdbObj - the dbObject to usemapper - the Mapper to usepublic boolean containsJavaFieldName(String name)
name - the name to search forpublic Annotation getAnnotation(Class<? extends Annotation> clazz)
clazz - the type to search forpublic <T> List<T> getAnnotations(Class<? extends Annotation> clazz)
T - the type of annotation to findclazz - the class to search forpublic Class<?> getClazz()
public String getCollectionName()
public Embedded getEmbeddedAnnotation()
public Entity getEntityAnnotation()
public List<MappedField> getFieldsAnnotatedWith(Class<? extends Annotation> clazz)
clazz - The Annotation to find.public Annotation getFirstAnnotation(Class<? extends Annotation> clazz)
clazz - The Annotation to find.public Field getIdField()
public List<org.mongodb.morphia.mapping.MappedClass.ClassMethodPair> getLifecycleMethods(Class<Annotation> clazz)
clazz - the annotation to search withpublic MappedField getMappedField(String storedName)
storedName - the name to search forpublic MappedField getMappedFieldByJavaField(String name)
name - the Java field name to search forpublic MappedField getMappedIdField()
public MappedField getMappedVersionField()
public List<MappedField> getPersistenceFields()
public Map<Class<? extends Annotation>,List<Annotation>> getRelevantAnnotations()
public void update()
public void validate(Mapper mapper)
mapper - the Mapper to use for validationprotected void basicValidate()
protected void discover(Mapper mapper)