Errai 3.0.1-SNAPSHOT

org.jboss.errai.jpa.client.local
Class ErraiIdentifiableType<X>

java.lang.Object
  extended by org.jboss.errai.jpa.client.local.ErraiManagedType<X>
      extended by org.jboss.errai.jpa.client.local.ErraiIdentifiableType<X>
Type Parameters:
X - The actual type described by this metatype.
All Implemented Interfaces:
javax.persistence.metamodel.IdentifiableType<X>, javax.persistence.metamodel.ManagedType<X>, javax.persistence.metamodel.Type<X>
Direct Known Subclasses:
ErraiEntityType

public abstract class ErraiIdentifiableType<X>
extends ErraiManagedType<X>
implements javax.persistence.metamodel.IdentifiableType<X>

Errai implementation of the JPA IdentifiableType metamodel interface. Specializes ManagedType by adding properties related to ID and version attributes.

Author:
Jonathan Fuerth

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.persistence.metamodel.Type
javax.persistence.metamodel.Type.PersistenceType
 
Field Summary
 
Fields inherited from class org.jboss.errai.jpa.client.local.ErraiManagedType
javaType
 
Constructor Summary
ErraiIdentifiableType(Class<X> javaType)
           
 
Method Summary
<Y> void
addAttribute(javax.persistence.metamodel.Attribute<X,Y> attribute)
           
abstract
<Y> void
deliverPostLoad(X targetEntity)
          Delivers the PostLoad event to the post-load listeners on the given instance of this entity.
abstract  void deliverPostPersist(X targetEntity)
          Delivers the PostPersist event to the post-persist listeners on the given instance of this entity.
abstract  void deliverPostRemove(X targetEntity)
          Delivers the PostRemove event to the post-Remove listeners on the given instance of this entity.
abstract  void deliverPostUpdate(X targetEntity)
          Delivers the PostUpdate event to the post-Update listeners on the given instance of this entity.
abstract  void deliverPrePersist(X targetEntity)
          Delivers the PrePersist event to the pre-persist listeners on the given instance of this entity.
abstract  void deliverPreRemove(X targetEntity)
          Delivers the PreRemove event to the pre-Remove listeners on the given instance of this entity.
abstract  void deliverPreUpdate(X targetEntity)
          Delivers the PreUpdate event to the pre-Update listeners on the given instance of this entity.
 X fromJson(javax.persistence.EntityManager em, com.google.gwt.json.client.JSONValue jsonValue)
          Converts the given JSONValue, which represents an instance of this entity type, into the actual instance of this entity type that exists in the given EntityManager's persistence context.
<Y> javax.persistence.metamodel.SingularAttribute<X,Y>
getDeclaredId(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(Class<Y> type)
          Return the attribute that corresponds to the version attribute declared by the entity or mapped superclass.
<Y> ErraiSingularAttribute<? super X,Y>
getId(Class<Y> type)
          Return the attribute that corresponds to the id attribute of the entity or mapped superclass.
 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.Type.PersistenceType getPersistenceType()
          Return the persistence type.
 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(Class<Y> type)
          Return the attribute that corresponds to the version attribute of the entity or mapped superclass.
 boolean hasSingleIdAttribute()
          Whether the identifiable type has a single id attribute.
 boolean hasVersionAttribute()
          Whether the identifiable type has a version attribute.
 String toString()
           
 
Methods inherited from class org.jboss.errai.jpa.client.local.ErraiManagedType
getAttribute, getAttributes, getCollection, getCollection, getDeclaredAttribute, getDeclaredAttributes, getDeclaredCollection, getDeclaredCollection, getDeclaredList, getDeclaredList, getDeclaredMap, getDeclaredMap, getDeclaredPluralAttributes, getDeclaredSet, getDeclaredSet, getDeclaredSingularAttribute, getDeclaredSingularAttribute, getDeclaredSingularAttributes, getJavaType, getList, getList, getMap, getMap, getPluralAttributes, getSet, getSet, getSingularAttribute, getSingularAttribute, getSingularAttributes, getSubtypes, isSuperclassOf, mergeState, newInstance, parseInlineJson, parsePluralJsonReference, parseSingularJsonReference, toJson
 
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
 
Methods inherited from interface javax.persistence.metamodel.Type
getJavaType
 

Constructor Detail

ErraiIdentifiableType

public ErraiIdentifiableType(Class<X> javaType)
Method Detail

deliverPrePersist

public abstract void deliverPrePersist(X targetEntity)
Delivers the PrePersist event to the pre-persist listeners on the given instance of this entity.

Parameters:
targetEntity - The entity instance to deliver the PrePersist event to.

deliverPostPersist

public abstract void deliverPostPersist(X targetEntity)
Delivers the PostPersist event to the post-persist listeners on the given instance of this entity.

Parameters:
targetEntity - The entity instance to deliver the PostPersist event to.

deliverPreUpdate

public abstract void deliverPreUpdate(X targetEntity)
Delivers the PreUpdate event to the pre-Update listeners on the given instance of this entity.

Parameters:
targetEntity - The entity instance to deliver the PreUpdate event to.

deliverPostUpdate

public abstract void deliverPostUpdate(X targetEntity)
Delivers the PostUpdate event to the post-Update listeners on the given instance of this entity.

Parameters:
targetEntity - The entity instance to deliver the PostUpdate event to.

deliverPreRemove

public abstract void deliverPreRemove(X targetEntity)
Delivers the PreRemove event to the pre-Remove listeners on the given instance of this entity.

Parameters:
targetEntity - The entity instance to deliver the PreRemove event to.

deliverPostRemove

public abstract void deliverPostRemove(X targetEntity)
Delivers the PostRemove event to the post-Remove listeners on the given instance of this entity.

Parameters:
targetEntity - The entity instance to deliver the PostRemove event to.

deliverPostLoad

public abstract <Y> void deliverPostLoad(X targetEntity)
Delivers the PostLoad event to the post-load listeners on the given instance of this entity.

Parameters:
targetEntity - The entity instance to deliver the PostLoad event to.

fromJson

public X fromJson(javax.persistence.EntityManager em,
                  com.google.gwt.json.client.JSONValue jsonValue)
Converts the given JSONValue, which represents an instance of this entity type, into the actual instance of this entity type that exists in the given EntityManager's persistence context. References to other entities are recursively retrieved from the EntityManager.

Specified by:
fromJson in class ErraiManagedType<X>
Parameters:
em - The EntityManager that owns this entity type and houses the persistence context.
jsonValue - A value that represents an instance of this entity type.
Returns:
A managed entity that is in the given EntityManager's persistence context.

addAttribute

public <Y> void addAttribute(javax.persistence.metamodel.Attribute<X,Y> attribute)
Overrides:
addAttribute in class ErraiManagedType<X>

getId

public <Y> ErraiSingularAttribute<? super X,Y> getId(Class<Y> type)
Description copied from interface: javax.persistence.metamodel.IdentifiableType
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

getDeclaredId

public <Y> javax.persistence.metamodel.SingularAttribute<X,Y> getDeclaredId(Class<Y> type)
Description copied from interface: javax.persistence.metamodel.IdentifiableType
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

getVersion

public <Y> javax.persistence.metamodel.SingularAttribute<? super X,Y> getVersion(Class<Y> type)
Description copied from interface: javax.persistence.metamodel.IdentifiableType
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

getDeclaredVersion

public <Y> javax.persistence.metamodel.SingularAttribute<X,Y> getDeclaredVersion(Class<Y> type)
Description copied from interface: javax.persistence.metamodel.IdentifiableType
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

getSupertype

public javax.persistence.metamodel.IdentifiableType<? super X> getSupertype()
Description copied from interface: javax.persistence.metamodel.IdentifiableType
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

hasSingleIdAttribute

public boolean hasSingleIdAttribute()
Description copied from interface: javax.persistence.metamodel.IdentifiableType
Whether the identifiable type has a single 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 the identifiable type has a single id attribute

hasVersionAttribute

public boolean hasVersionAttribute()
Description copied from interface: javax.persistence.metamodel.IdentifiableType
Whether the identifiable type has a version attribute.

Specified by:
hasVersionAttribute in interface javax.persistence.metamodel.IdentifiableType<X>
Returns:
boolean indicating whether the identifiable type has a version attribute

getIdClassAttributes

public Set<javax.persistence.metamodel.SingularAttribute<? super X,?>> getIdClassAttributes()
Description copied from interface: javax.persistence.metamodel.IdentifiableType
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

getIdType

public javax.persistence.metamodel.Type<?> getIdType()
Description copied from interface: javax.persistence.metamodel.IdentifiableType
Return the type that represents the type of the id.

Specified by:
getIdType in interface javax.persistence.metamodel.IdentifiableType<X>
Returns:
type of id

getPersistenceType

public javax.persistence.metamodel.Type.PersistenceType getPersistenceType()
Description copied from interface: javax.persistence.metamodel.Type
Return the persistence type.

Specified by:
getPersistenceType in interface javax.persistence.metamodel.Type<X>
Returns:
persistence type

toString

public String toString()
Overrides:
toString in class ErraiManagedType<X>

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.