public class PersistenceContext extends Object
Constructor and Description |
---|
PersistenceContext(ErraiMetamodel mm)
Creates a new PersistenceContext that can track entities represented within
the given metamodel.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Key<?,?> key)
Returns true if this persistence context contains an entity retrievable by
the given key.
|
Set<Map.Entry<Key<?,?>,Object>> |
entrySet()
Returns the set of all entities in this persistence context.
|
<X> X |
get(Key<X,?> key)
Looks up and returns the entity that matches the given key.
|
<X,Y> void |
put(Key<X,Y> key,
X object)
Stores the given object in the persistence context.
|
void |
remove(Key<?,?> key)
Removes the entity having the given key from this persistence context.
|
Collection<Object> |
values()
Returns the collection of all entities in this persistence context.
|
public PersistenceContext(ErraiMetamodel mm)
mm
- The metamodel that knows about all the entity types that will be
stored in this Persistence Context. Not null.public <X,Y> void put(Key<X,Y> key, X object)
key
- The key to store the entity under. Care must be taken that this
key type reflects the actual runtime type of the given object.object
- The object to put into the persistence context.public void remove(Key<?,?> key)
key
- The key of the entity to remove. The key type must be an exact
match for the target object's runtime type.public <X> X get(Key<X,?> key)
key
- the key to look up. The entity type portion can be any supertype
of the matched entity. The ID is always an exact match. Must not
be null.public boolean contains(Key<?,?> key)
get(Key)
.key
- the identity of the entity to look for. Must not be null.public Set<Map.Entry<Key<?,?>,Object>> entrySet()
public Collection<Object> values()
Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.