Class MappedClass


  • public class MappedClass
    extends Object
    Developer note.
    This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
    • Constructor Detail

      • MappedClass

        public MappedClass​(EntityModel entityModel,
                           Mapper mapper)
        Creates a MappedClass instance
        Parameters:
        entityModel - the ClassModel
        mapper - the Mapper to use
    • Method Detail

      • getSubtypes

        public List<MappedClass> getSubtypes()
        Returns:
        the MappedClasses for all the known subtypes
      • update

        public void update()
        Update mappings based on fields/annotations.
      • getFields

        public List<MappedField> getFields​(Class<? extends Annotation> clazz)
        Returns fields annotated with the clazz
        Parameters:
        clazz - The Annotation to find.
        Returns:
        the list of fields
      • getSuperClass

        public MappedClass getSuperClass()
        This is an internal method subject to change without notice.
        Returns:
        the parent class of this type if there is one null otherwise
        Since:
        1.3
      • isInterface

        public boolean isInterface()
        Returns:
        true if the MappedClass is an interface
      • isAbstract

        public boolean isAbstract()
        This is an internal method subject to change without notice.
        Returns:
        true if the MappedClass is abstract
        Since:
        1.3
      • callLifecycleMethods

        public void callLifecycleMethods​(Class<? extends Annotation> event,
                                         Object entity,
                                         org.bson.Document document,
                                         Mapper mapper)
        Call the lifecycle methods
        Parameters:
        event - the lifecycle annotation
        entity - the entity to process
        document - the document to use
        mapper - the Mapper to use
      • hasLifecycle

        public boolean hasLifecycle​(Class<? extends Annotation> type)
        Checks if this mapped type has the given lifecycle event defined
        Parameters:
        type - the event type
        Returns:
        true if this annotation has been found
      • getAnnotation

        public <T extends Annotation> T getAnnotation​(Class<T> clazz)
        Looks for an annotation of the type given
        Type Parameters:
        T - the annotation type
        Parameters:
        clazz - the type to search for
        Returns:
        the instance if it was found or null
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • getEmbeddedAnnotation

        public Embedded getEmbeddedAnnotation()
        Returns:
        the embeddedAn
      • getEntityAnnotation

        public Entity getEntityAnnotation()
        Returns:
        the entityAn
      • getIdField

        public MappedField getIdField()
        Returns:
        the idField
      • getMappedField

        public MappedField getMappedField​(String storedName)
        Returns the MappedField by the name that it will stored in mongodb as
        Parameters:
        storedName - the name to search for
        Returns:
        true if that mapped field name is found
      • getMappedFieldByJavaField

        public MappedField getMappedFieldByJavaField​(String name)
        Returns MappedField for a given java field name on the this MappedClass
        Parameters:
        name - the Java field name to search for
        Returns:
        the MappedField for the named Java field
      • getVersionField

        public MappedField getVersionField()
        Returns:
        the ID field for the class
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getType

        public Class<?> getType()
        Returns:
        the clazz
      • getCollectionName

        public String getCollectionName()
        Returns:
        the collName
      • validate

        public void validate​(Mapper mapper)
        Validates this MappedClass
        Parameters:
        mapper - the Mapper to use for validation
      • getEntityModel

        public EntityModel<?> getEntityModel()
        Returns:
        the underlying model of the type