Class IdentifiableTypeImpl<X>

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

public abstract class IdentifiableTypeImpl<X> extends ManagedTypeImpl<X> implements 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:
  • Constructor Details

  • Method Details

    • initializeIdAttributes

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

      public <Y> SingularAttribute<X,Y> getDeclaredId(Class<Y> type)
      Return the attribute that corresponds to the id attribute declared by the entity or mapped superclass.
      Specified by:
      getDeclaredId in interface IdentifiableType<X>
      Parameters:
      type - the type of the represented declared id attribute
      Returns:
      declared id attribute
      Throws:
      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> SingularAttribute<X,Y> getDeclaredVersion(Class<Y> type)
      Return the attribute that corresponds to the version attribute declared by the entity or mapped superclass.
      Specified by:
      getDeclaredVersion in interface IdentifiableType<X>
      Parameters:
      type - the type of the represented declared version attribute
      Returns:
      declared version attribute
      Throws:
      IllegalArgumentException - if version attribute of the type is not declared in the identifiable type
    • getIdClassAttributes

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

      public <Y> SingularAttribute<? super X,Y> getId(Class<Y> type)
      Return the attribute that corresponds to the id attribute of the entity or mapped superclass.
      Specified by:
      getId in interface IdentifiableType<X>
      Parameters:
      type - the type of the represented id attribute
      Returns:
      id attribute
      Throws:
      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 Type<?> getIdType()
      Return the type that represents the type of the id.
      Specified by:
      getIdType in interface IdentifiableType<X>
      Returns:
      type of id
    • getSupertype

      public 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 IdentifiableType<X>
      Returns:
      supertype of identifiable type or null if no such supertype
    • getVersion

      public <Y> SingularAttribute<? super X,Y> getVersion(Class<Y> type)
      Return the attribute that corresponds to the version attribute of the entity or mapped superclass.
      Specified by:
      getVersion in interface IdentifiableType<X>
      Parameters:
      type - the type of the represented version attribute
      Returns:
      version attribute
      Throws:
      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 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 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>
    • setSupertype

      protected void setSupertype(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