Errai 3.0.1-SNAPSHOT

org.jboss.errai.jpa.client.local
Class ErraiMetamodel

java.lang.Object
  extended by org.jboss.errai.jpa.client.local.ErraiMetamodel
All Implemented Interfaces:
javax.persistence.metamodel.Metamodel

public class ErraiMetamodel
extends Object
implements javax.persistence.metamodel.Metamodel

Trivial implementation of the JPA Metamodel class. This class is normally instantiated and populated by generated code in ErraiEntityManager.

Instances of this class have two distinct lifecycle phases: when first constructed, the package-private methods addEntityType(EntityType) and friends may be called to add new entity types. This is normally done from generated code, but test code can also do this manually. Once freeze() has been called, the instance is "frozen." When frozen, all the Metamodel interface methods operate properly, but the addXXX() methods throw exceptions when called.

Author:
Jonathan Fuerth

Constructor Summary
ErraiMetamodel()
           
 
Method Summary
<X> javax.persistence.metamodel.EmbeddableType<X>
embeddable(Class<X> cls)
          Return the metamodel embeddable type representing the embeddable class.
<X> ErraiEntityType<X>
entity(Class<X> cls)
          Return the metamodel entity type representing the entity.
<X> ErraiEntityType<X>
entity(String className)
          Retrieves an ErraiEntityType by name rather than class reference.
 Set<javax.persistence.metamodel.EmbeddableType<?>> getEmbeddables()
          Return the metamodel embeddable types.
 Set<javax.persistence.metamodel.EntityType<?>> getEntities()
          Return the metamodel entity types.
 Set<javax.persistence.metamodel.ManagedType<?>> getManagedTypes()
          Return the metamodel managed types.
<X> javax.persistence.metamodel.ManagedType<X>
managedType(Class<X> cls)
          Return the metamodel managed type representing the entity, mapped superclass, or embeddable class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErraiMetamodel

public ErraiMetamodel()
Method Detail

entity

public <X> ErraiEntityType<X> entity(String className)
Retrieves an ErraiEntityType by name rather than class reference.

Parameters:
className - The fully-qualified class name of the entity type to retrieve (as returned by Class.getName()). Null not permitted.
Returns:
the ErraiEntityType associated with the named class.
Throws:
IllegalArgumentException - if the given class name is not an known entity type.

entity

public <X> ErraiEntityType<X> entity(Class<X> cls)
Description copied from interface: javax.persistence.metamodel.Metamodel
Return the metamodel entity type representing the entity.

Specified by:
entity in interface javax.persistence.metamodel.Metamodel
Parameters:
cls - the type of the represented entity
Returns:
the metamodel entity type

managedType

public <X> javax.persistence.metamodel.ManagedType<X> managedType(Class<X> cls)
Description copied from interface: javax.persistence.metamodel.Metamodel
Return the metamodel managed type representing the entity, mapped superclass, or embeddable class.

Specified by:
managedType in interface javax.persistence.metamodel.Metamodel
Parameters:
cls - the type of the represented managed class
Returns:
the metamodel managed type

embeddable

public <X> javax.persistence.metamodel.EmbeddableType<X> embeddable(Class<X> cls)
Description copied from interface: javax.persistence.metamodel.Metamodel
Return the metamodel embeddable type representing the embeddable class.

Specified by:
embeddable in interface javax.persistence.metamodel.Metamodel
Parameters:
cls - the type of the represented embeddable class
Returns:
the metamodel embeddable type

getManagedTypes

public Set<javax.persistence.metamodel.ManagedType<?>> getManagedTypes()
Description copied from interface: javax.persistence.metamodel.Metamodel
Return the metamodel managed types.

Specified by:
getManagedTypes in interface javax.persistence.metamodel.Metamodel
Returns:
the metamodel managed types

getEntities

public Set<javax.persistence.metamodel.EntityType<?>> getEntities()
Description copied from interface: javax.persistence.metamodel.Metamodel
Return the metamodel entity types.

Specified by:
getEntities in interface javax.persistence.metamodel.Metamodel
Returns:
the metamodel entity types

getEmbeddables

public Set<javax.persistence.metamodel.EmbeddableType<?>> getEmbeddables()
Description copied from interface: javax.persistence.metamodel.Metamodel
Return the metamodel embeddable types. Returns empty set if there are no embeddable types.

Specified by:
getEmbeddables in interface javax.persistence.metamodel.Metamodel
Returns:
the metamodel embeddable types

Errai 3.0.1-SNAPSHOT

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