Package dev.morphia.mapping.codec.pojo
Class EntityModel<T>
- java.lang.Object
-
- dev.morphia.mapping.codec.pojo.EntityModel<T>
-
- Type Parameters:
T
- the entity type
public class EntityModel<T> extends Object
A model of metadata about a type- Since:
- 2.0
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Method Summary
-
-
-
Method Detail
-
callLifecycleMethods
public void callLifecycleMethods(Class<? extends Annotation> event, Object entity, org.bson.Document document, Mapper mapper)
Invokes any lifecycle methods- Parameters:
event
- the event to runentity
- the entity to usedocument
- the document used in persistencemapper
- the mapper to use
-
getAnnotation
public <A> A getAnnotation(Class<? extends Annotation> clazz)
- Type Parameters:
A
- the annotation type- Parameters:
clazz
- the annotation class- Returns:
- the annotation instance or null if not found
-
getAnnotations
public <A> List<A> getAnnotations(Class<? extends Annotation> clazz)
- Type Parameters:
A
- the annotation type- Parameters:
clazz
- the annotation class- Returns:
- all annotation instance of the given type
-
getAnnotations
public Map<Class<? extends Annotation>,List<Annotation>> getAnnotations()
Returns all the annotations on this model- Returns:
- the list of annotations
-
getCollectionName
public String getCollectionName()
- Returns:
- the mapped collection name for the type
-
getDiscriminator
public String getDiscriminator()
- Returns:
- the discriminator
-
getDiscriminatorKey
public String getDiscriminatorKey()
- Returns:
- the discriminator key
-
getFieldModelByName
public FieldModel<?> getFieldModelByName(String name)
- Parameters:
name
- the property name- Returns:
- the named FieldModel or null if it does not exist
-
getFieldModels
public Collection<FieldModel<?>> getFieldModels()
Returns all the fields on this model- Returns:
- the list of fields
-
getIdModel
public FieldModel<?> getIdModel()
- Returns:
- the model for the id field
-
getInstanceCreator
public MorphiaInstanceCreator<T> getInstanceCreator()
- Returns:
- a new InstanceCreator instance for the ClassModel
-
getInstanceCreatorFactory
public InstanceCreatorFactory<T> getInstanceCreatorFactory()
- Returns:
- thee creator factory
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getLifecycleMethods
public Map<Class<? extends Annotation>,List<ClassMethodPair>> getLifecycleMethods()
- Returns:
- the lifecycle event methods
-
getName
public String getName()
- Returns:
- the name of this model
-
hasLifecycle
public boolean hasLifecycle(Class<? extends Annotation> type)
- Parameters:
type
- the lifecycle event type- Returns:
- true if that even has been configured
-
useDiscriminator
protected boolean useDiscriminator()
-
-