Class IdentifiableTypeImpl<X>

  • Type Parameters:
    X - The represented entity or mapped superclass type.
    All Implemented Interfaces:
    java.io.Serializable, javax.persistence.metamodel.IdentifiableType<X>, javax.persistence.metamodel.ManagedType<X>, javax.persistence.metamodel.Type<X>
    Direct Known Subclasses:
    EntityTypeImpl, MappedSuperclassTypeImpl

    public abstract class IdentifiableTypeImpl<X>
    extends ManagedTypeImpl<X>
    implements javax.persistence.metamodel.IdentifiableType<X>

    Purpose: Provides the implementation for the Entity interface of the JPA 2.0 Metamodel API (part of the JSR-317 EJB 3.1 Criteria API)

    Description: Instances of the type IdentifiableType represent entity or mapped superclass types.

    Since:
    EclipseLink 1.2 - JPA 2.0
    See Also:
    EntityType, Serialized Form
    • Constructor Detail

      • IdentifiableTypeImpl

        protected IdentifiableTypeImpl​(MetamodelImpl metamodel,
                                       org.eclipse.persistence.descriptors.ClassDescriptor descriptor)
    • Method Detail

      • initializeIdAttributes

        protected void initializeIdAttributes()
        INTERNAL: The idAttributes collection is computed at the end of MetamodelImpl.initialize()
      • getDeclaredId

        public <Y> javax.persistence.metamodel.SingularAttribute<X,​Y> getDeclaredId​(java.lang.Class<Y> type)
        Return the attribute that corresponds to the id attribute declared by the entity or mapped superclass.
        Specified by:
        getDeclaredId in interface javax.persistence.metamodel.IdentifiableType<X>
        Parameters:
        type - the type of the represented declared id attribute
        Returns:
        declared id attribute
        Throws:
        java.lang.IllegalArgumentException - if id attribute of the given type is not declared in the identifiable type or if the identifiable type has an id class
      • getDeclaredVersion

        public <Y> javax.persistence.metamodel.SingularAttribute<X,​Y> getDeclaredVersion​(java.lang.Class<Y> type)
        Return the attribute that corresponds to the version attribute declared by the entity or mapped superclass.
        Specified by:
        getDeclaredVersion in interface javax.persistence.metamodel.IdentifiableType<X>
        Parameters:
        type - the type of the represented declared version attribute
        Returns:
        declared version attribute
        Throws:
        java.lang.IllegalArgumentException - if version attribute of the type is not declared in the identifiable type
      • getIdClassAttributes

        public java.util.Set<javax.persistence.metamodel.SingularAttribute<? super X,​?>> getIdClassAttributes()
        Return the attributes corresponding to the id class of the identifiable type.
        Specified by:
        getIdClassAttributes in interface javax.persistence.metamodel.IdentifiableType<X>
        Returns:
        id attributes
        Throws:
        java.lang.IllegalArgumentException - if the identifiable type does not have an id class
      • getId

        public <Y> javax.persistence.metamodel.SingularAttribute<? super X,​Y> getId​(java.lang.Class<Y> type)
        Return the attribute that corresponds to the id attribute of the entity or mapped superclass.
        Specified by:
        getId in interface javax.persistence.metamodel.IdentifiableType<X>
        Parameters:
        type - the type of the represented id attribute
        Returns:
        id attribute
        Throws:
        java.lang.IllegalArgumentException - if id attribute of the given type is not present in the identifiable type or if the identifiable type has an id class
      • getIdType

        public javax.persistence.metamodel.Type<?> getIdType()
        Return the type that represents the type of the id.
        Specified by:
        getIdType in interface javax.persistence.metamodel.IdentifiableType<X>
        Returns:
        type of id
      • getSupertype

        public javax.persistence.metamodel.IdentifiableType<? super X> getSupertype()
        Return the identifiable type that corresponds to the most specific mapped superclass or entity extended by the entity or mapped superclass.
        Specified by:
        getSupertype in interface javax.persistence.metamodel.IdentifiableType<X>
        Returns:
        supertype of identifiable type or null if no such supertype
      • getVersion

        public <Y> javax.persistence.metamodel.SingularAttribute<? super X,​Y> getVersion​(java.lang.Class<Y> type)
        Return the attribute that corresponds to the version attribute of the entity or mapped superclass.
        Specified by:
        getVersion in interface javax.persistence.metamodel.IdentifiableType<X>
        Parameters:
        type - the type of the represented version attribute
        Returns:
        version attribute
        Throws:
        java.lang.IllegalArgumentException - if version attribute of the given type is not present in the identifiable type
      • hasSingleIdAttribute

        public boolean hasSingleIdAttribute()
        Whether or not the identifiable type has an id attribute. Returns true for a simple id or embedded id; returns false for an idclass.
        Specified by:
        hasSingleIdAttribute in interface javax.persistence.metamodel.IdentifiableType<X>
        Returns:
        boolean indicating whether or not the identifiable type has a single id attribute
      • hasVersionAttribute

        public boolean hasVersionAttribute()
        Whether or not the identifiable type has a version attribute.
        Specified by:
        hasVersionAttribute in interface javax.persistence.metamodel.IdentifiableType<X>
        Returns:
        boolean indicating whether or not the identifiable type has a version attribute
      • isIdentifiableType

        protected boolean isIdentifiableType()
        INTERNAL: Return whether this type is identifiable. This would be EntityType and MappedSuperclassType
        Overrides:
        isIdentifiableType in class ManagedTypeImpl<X>
        Returns:
      • setSupertype

        protected void setSupertype​(javax.persistence.metamodel.IdentifiableType<? super X> superType)
        INTERNAL: Set the superType for this IdentifiableType - only after all ManagedTypes have been instantiated for this Metamodel.

        Top-level identifiable types have their supertype set to null.

        Parameters:
        superType - - the entity or mappedSuperclass superType