org.hibernate.ejb.metamodel
Class AbstractIdentifiableType<X>

java.lang.Object
  extended by org.hibernate.ejb.metamodel.AbstractType<X>
      extended by org.hibernate.ejb.metamodel.AbstractManagedType<X>
          extended by org.hibernate.ejb.metamodel.AbstractIdentifiableType<X>
All Implemented Interfaces:
Serializable, javax.persistence.metamodel.IdentifiableType<X>, javax.persistence.metamodel.ManagedType<X>, javax.persistence.metamodel.Type<X>
Direct Known Subclasses:
EntityTypeImpl, MappedSuperclassTypeImpl

public abstract class AbstractIdentifiableType<X>
extends AbstractManagedType<X>
implements javax.persistence.metamodel.IdentifiableType<X>, Serializable

Defines commonality for the JPA IdentifiableType types. JPA defines identifiable types as entities or mapped-superclasses. Basically things to which an identifier can be attached.

NOTE : Currently we only really have support for direct entities in the Hibernate metamodel as the information for them is consumed into the closest actual entity subclass(es) in the internal Hibernate mapping-metamodel.

Author:
Steve Ebersole
See Also:
Serialized Form

Nested Class Summary
static interface AbstractIdentifiableType.Builder<X>
           
 
Nested classes/interfaces inherited from interface javax.persistence.metamodel.Type
javax.persistence.metamodel.Type.PersistenceType
 
Constructor Summary
AbstractIdentifiableType(Class<X> javaType, AbstractIdentifiableType<? super X> superType, boolean hasIdentifierProperty, boolean versioned)
           
 
Method Summary
protected  void checkDeclaredId()
          Centralized check to ensure the id is actually declared on the class mapped here, as opposed to a super class.
protected  void checkDeclaredVersion()
          Centralized check to ensure the version (if one) is actually declared on the class mapped here, as opposed to a super class.
protected  void checkSimpleId()
          Centralized check to ensure the id for this hierarchy is a simple one (i.e., does not use an id-class).
 AbstractIdentifiableType.Builder<X> getBuilder()
           
<Y> javax.persistence.metamodel.SingularAttribute<X,Y>
getDeclaredId(Class<Y> javaType)
          
 javax.persistence.metamodel.SingularAttribute<X,?> getDeclaredVersion()
          For used to retrieve the declared version when populating the static metamodel.
<Y> javax.persistence.metamodel.SingularAttribute<X,Y>
getDeclaredVersion(Class<Y> javaType)
          
<Y> javax.persistence.metamodel.SingularAttribute<? super X,Y>
getId(Class<Y> javaType)
          
 Set<javax.persistence.metamodel.SingularAttribute<? super X,?>> getIdClassAttributes()
          
 javax.persistence.metamodel.Type<?> getIdType()
          
 AbstractIdentifiableType<? super X> getSupertype()
          
<Y> javax.persistence.metamodel.SingularAttribute<? super X,Y>
getVersion(Class<Y> javaType)
          
 boolean hasDeclaredVersionAttribute()
           
 boolean hasSingleIdAttribute()
          
 boolean hasVersionAttribute()
          
protected  AbstractIdentifiableType<? super X> requireSupertype()
           
 
Methods inherited from class org.hibernate.ejb.metamodel.AbstractManagedType
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, isPrimitiveVariant, lock
 
Methods inherited from class org.hibernate.ejb.metamodel.AbstractType
getJavaType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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
 
Methods inherited from interface javax.persistence.metamodel.Type
getJavaType, getPersistenceType
 

Constructor Detail

AbstractIdentifiableType

public AbstractIdentifiableType(Class<X> javaType,
                                AbstractIdentifiableType<? super X> superType,
                                boolean hasIdentifierProperty,
                                boolean versioned)
Method Detail

getSupertype

public AbstractIdentifiableType<? super X> getSupertype()

Specified by:
getSupertype in interface javax.persistence.metamodel.IdentifiableType<X>
Overrides:
getSupertype in class AbstractManagedType<X>

requireSupertype

protected AbstractIdentifiableType<? super X> requireSupertype()

hasSingleIdAttribute

public boolean hasSingleIdAttribute()

Specified by:
hasSingleIdAttribute in interface javax.persistence.metamodel.IdentifiableType<X>

getId

public <Y> javax.persistence.metamodel.SingularAttribute<? super X,Y> getId(Class<Y> javaType)

Specified by:
getId in interface javax.persistence.metamodel.IdentifiableType<X>

checkSimpleId

protected void checkSimpleId()
Centralized check to ensure the id for this hierarchy is a simple one (i.e., does not use an id-class).

See Also:
checkIdClass()

getDeclaredId

public <Y> javax.persistence.metamodel.SingularAttribute<X,Y> getDeclaredId(Class<Y> javaType)

Specified by:
getDeclaredId in interface javax.persistence.metamodel.IdentifiableType<X>

checkDeclaredId

protected void checkDeclaredId()
Centralized check to ensure the id is actually declared on the class mapped here, as opposed to a super class.


getIdType

public javax.persistence.metamodel.Type<?> getIdType()

Specified by:
getIdType in interface javax.persistence.metamodel.IdentifiableType<X>

getIdClassAttributes

public Set<javax.persistence.metamodel.SingularAttribute<? super X,?>> getIdClassAttributes()

Specified by:
getIdClassAttributes in interface javax.persistence.metamodel.IdentifiableType<X>

hasVersionAttribute

public boolean hasVersionAttribute()

Specified by:
hasVersionAttribute in interface javax.persistence.metamodel.IdentifiableType<X>

hasDeclaredVersionAttribute

public boolean hasDeclaredVersionAttribute()

getVersion

public <Y> javax.persistence.metamodel.SingularAttribute<? super X,Y> getVersion(Class<Y> javaType)

Specified by:
getVersion in interface javax.persistence.metamodel.IdentifiableType<X>

getDeclaredVersion

public <Y> javax.persistence.metamodel.SingularAttribute<X,Y> getDeclaredVersion(Class<Y> javaType)

Specified by:
getDeclaredVersion in interface javax.persistence.metamodel.IdentifiableType<X>

getDeclaredVersion

public javax.persistence.metamodel.SingularAttribute<X,?> getDeclaredVersion()
For used to retrieve the declared version when populating the static metamodel.

Returns:
The declared

checkDeclaredVersion

protected void checkDeclaredVersion()
Centralized check to ensure the version (if one) is actually declared on the class mapped here, as opposed to a super class.


getBuilder

public AbstractIdentifiableType.Builder<X> getBuilder()
Overrides:
getBuilder in class AbstractManagedType<X>


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.