Class PersistentDescriptor

  • All Implemented Interfaces:
    ClassDescriptor

    public class PersistentDescriptor
    extends Object
    implements ClassDescriptor
    A default ClassDescriptor implementation for persistent objects.
    Since:
    3.0
    • Constructor Detail

      • PersistentDescriptor

        public PersistentDescriptor()
        Creates a PersistentDescriptor.
    • Method Detail

      • addSuperProperty

        public void addSuperProperty​(PropertyDescriptor property)
        Registers a superclass property.
      • addDeclaredProperty

        public void addDeclaredProperty​(PropertyDescriptor property)
        Registers a property. This method is useful to customize default ClassDescriptor generated from ObjEntity by adding new properties or overriding the standard ones.
      • addRootDbEntity

        public void addRootDbEntity​(DbEntity dbEntity)
        Adds a root DbEntity to the list of roots, filtering duplicates.
      • removeDeclaredProperty

        public void removeDeclaredProperty​(String propertyName)
        Removes declared property. This method can be used to customize default ClassDescriptor generated from ObjEntity.
      • addSubclassDescriptor

        public void addSubclassDescriptor​(String className,
                                          ClassDescriptor subclassDescriptor)
        Adds a subclass descriptor that maps to a given class name.
      • getRootDbEntities

        public Collection<DbEntity> getRootDbEntities()
        Description copied from interface: ClassDescriptor
        Returns a collection of DbEntities that are the root tables for this descriptor's ObjEntity. Usually such collection would contain only one entity, however in cases involving subclass horizontal inheritance, it will be more than one, and in cases of abstract entities with no subclasses, the collection will be empty.
        Specified by:
        getRootDbEntities in interface ClassDescriptor
      • getAdditionalDbEntities

        public Map<String,​DbEntity> getAdditionalDbEntities()
        Description copied from interface: ClassDescriptor
        Returns information about additional db entities that is used for this ObjEntity (i.e. for flattened attributes).

        Keys are full paths for corresponding flattened attributes.

        Specified by:
        getAdditionalDbEntities in interface ClassDescriptor
        Returns:
        information about additional db entities
      • getSubclassDescriptor

        public ClassDescriptor getSubclassDescriptor​(Class<?> objectClass)
        Description copied from interface: ClassDescriptor
        Returns the most "specialized" descriptor for a given class. This method assumes that the following is true:
         this.getObjectClass().isAssignableFrom(objectClass)
         
        Specified by:
        getSubclassDescriptor in interface ClassDescriptor
      • getDiscriminatorColumns

        public Collection<ObjAttribute> getDiscriminatorColumns()
        Description copied from interface: ClassDescriptor
        Returns a collection of ObjAttribute for the described class, its superclasses and subclasses, that participate in inheritance qualifier. If a discriminator expression specifies a DbAttribute instead of an ObjAttribute, a synthetic ObjAttribute is created and returned.
        Specified by:
        getDiscriminatorColumns in interface ClassDescriptor
      • getMapArcProperties

        public Collection<ArcProperty> getMapArcProperties()
        Description copied from interface: ClassDescriptor
        Returns a collection over the arc properties whose reverse arcs are to-many maps. I.e. for each ArcProperty in returned collection, the following is true:
         arc.getComplimentaryReverseArc() instanceof ToManyMapProperty
         
        Specified by:
        getMapArcProperties in interface ClassDescriptor
      • getSuperclassDescriptor

        public ClassDescriptor getSuperclassDescriptor()
        Returns a descriptor of the mapped superclass or null if the descriptor's entity sits at the top of inheritance hierarchy.
        Specified by:
        getSuperclassDescriptor in interface ClassDescriptor
      • visitDeclaredProperties

        public boolean visitDeclaredProperties​(PropertyVisitor visitor)
        Description copied from interface: ClassDescriptor
        Passes the visitor to the properties "visit" method for all properties declared in this descriptor. This property set excludes inherited properties, even those that got overridden in this subclass. Walkthrough is terminated in case one of the properties returns false. Returns true if all visited properties returned true, false - if one property returned false.
        Specified by:
        visitDeclaredProperties in interface ClassDescriptor
        Since:
        3.0
      • visitAllProperties

        public boolean visitAllProperties​(PropertyVisitor visitor)
        Description copied from interface: ClassDescriptor
        Passes the visitor to the properties "visit" method for a combination of all properties, including properties declared in this descriptor, its super descriptors, and all subdescriptors. Walkthrough is terminated in case one of the properties returns false. Returns true if all visited properties returned true, false - if one property returned false.
        Specified by:
        visitAllProperties in interface ClassDescriptor
        Since:
        3.0
      • visitProperties

        public boolean visitProperties​(PropertyVisitor visitor)
        Description copied from interface: ClassDescriptor
        Passes the visitor to the properties "visit" method for all properties declared in this descriptor and all its super-decsriptors. Properties that are overridden in subdescriptors will include overridden information. Walkthrough is terminated in case one of the properties returns false. Returns true if all visited properties returned true, false - if one property returned false.
        Specified by:
        visitProperties in interface ClassDescriptor
      • setPersistenceStateAccessor

        public void setPersistenceStateAccessor​(Accessor persistenceStateAccessor)
      • setEntity

        public void setEntity​(ObjEntity entity)
      • setSuperclassDescriptor

        public void setSuperclassDescriptor​(ClassDescriptor superclassDescriptor)
      • setEntityQualifier

        public void setEntityQualifier​(Expression entityQualifier)
      • setEntityInheritanceTree

        public void setEntityInheritanceTree​(EntityInheritanceTree entityInheritanceTree)