Class IdentifiableTypeImpl<X>
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.metamodel.TypeImpl<X>
-
- org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl<X>
-
- org.eclipse.persistence.internal.jpa.metamodel.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
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl
descriptor, metamodel
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIdentifiableTypeImpl(MetamodelImpl metamodel, org.eclipse.persistence.descriptors.ClassDescriptor descriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <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.<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.<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.java.util.Set<javax.persistence.metamodel.SingularAttribute<? super X,?>>getIdClassAttributes()Return the attributes corresponding to the id class of the identifiable type.javax.persistence.metamodel.Type<?>getIdType()Return the type that represents the type of the id.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.<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.booleanhasSingleIdAttribute()Whether or not the identifiable type has an id attribute.booleanhasVersionAttribute()Whether or not the identifiable type has a version attribute.protected voidinitializeIdAttributes()INTERNAL: The idAttributes collection is computed at the end of MetamodelImpl.initialize()protected booleanisIdentifiableType()INTERNAL: Return whether this type is identifiable.protected voidsetSupertype(javax.persistence.metamodel.IdentifiableType<? super X> superType)INTERNAL: Set the superType for this IdentifiableType - only after all ManagedTypes have been instantiated for this Metamodel.-
Methods inherited from class org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl
create, getAttribute, getAttributes, getCollection, getCollection, getDeclaredAttribute, getDeclaredAttribute, getDeclaredAttributes, getDeclaredCollection, getDeclaredCollection, getDeclaredList, getDeclaredList, getDeclaredMap, getDeclaredMap, getDeclaredPluralAttributes, getDeclaredSet, getDeclaredSet, getDeclaredSingularAttribute, getDeclaredSingularAttribute, getDeclaredSingularAttributes, getDescriptor, getList, getList, getMap, getMap, getMembers, getMetamodel, getPluralAttributes, getSet, getSet, getSingularAttribute, getSingularAttribute, getSingularAttributes, getTypeClassFromAttributeOrMethodLevelAccessor, initialize, isManagedType, toStringHelper
-
Methods inherited from class org.eclipse.persistence.internal.jpa.metamodel.TypeImpl
getJavaType, getJavaType, getJavaTypeName, isEntity, isMappedSuperclass, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.persistence.metamodel.ManagedType
getAttribute, getAttributes, getCollection, getCollection, getDeclaredAttribute, getDeclaredAttributes, getDeclaredCollection, getDeclaredCollection, getDeclaredList, getDeclaredList, getDeclaredMap, getDeclaredMap, getDeclaredPluralAttributes, getDeclaredSet, getDeclaredSet, getDeclaredSingularAttribute, getDeclaredSingularAttribute, getDeclaredSingularAttributes, getList, getList, getMap, getMap, getPluralAttributes, getSet, getSet, getSingularAttribute, getSingularAttribute, getSingularAttributes
-
-
-
-
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:
getDeclaredIdin interfacejavax.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:
getDeclaredVersionin interfacejavax.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:
getIdClassAttributesin interfacejavax.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:
getIdin interfacejavax.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:
getIdTypein interfacejavax.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:
getSupertypein interfacejavax.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:
getVersionin interfacejavax.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:
hasSingleIdAttributein interfacejavax.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:
hasVersionAttributein interfacejavax.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:
isIdentifiableTypein classManagedTypeImpl<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
-
-