Package io.jmix.core
Class EntitySet
java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingCollection<E>
com.google.common.collect.ForwardingSet<Object>
io.jmix.core.EntitySet
- All Implemented Interfaces:
Serializable
,Iterable<Object>
,Collection<Object>
,Set<Object>
public class EntitySet
extends com.google.common.collect.ForwardingSet<Object>
implements Serializable
Implementation of
Set<Entity>
with convenient methods for getting entities by a prototype instance
or by a class and id.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Set
delegate()
<T> T
Returns the entity if it exists in the set.<T> T
get
(T prototype) Returns the entity if it exists in the set.<T> Collection<T>
Returns a collection of entities of the specified class.static EntitySet
of
(Collection<?> entities) Creates theEntitySet
by copying the given collection to the internal set.static EntitySet
Creates theEntitySet
wrapping an existing set.<T> Optional<T>
Returns the entity wrapped inOptional
if it exists in the set.<T> Optional<T>
optional
(T prototype) Returns the entity wrapped inOptional
if it exists in the set.Methods inherited from class com.google.common.collect.ForwardingSet
equals, hashCode, standardEquals, standardHashCode, standardRemoveAll
Methods inherited from class com.google.common.collect.ForwardingCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArray
Methods inherited from class com.google.common.collect.ForwardingObject
toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
EntitySet
public EntitySet() -
EntitySet
-
EntitySet
-
-
Method Details
-
of
Creates theEntitySet
wrapping an existing set. -
of
Creates theEntitySet
by copying the given collection to the internal set. -
optional
Returns the entity wrapped inOptional
if it exists in the set.- Parameters:
entityClass
- class of entityentityId
- entity id
-
optional
Returns the entity wrapped inOptional
if it exists in the set.- Parameters:
prototype
- a prototype instance whose class and id are used to look up an entity in the set.
-
get
Returns the entity if it exists in the set.- Parameters:
entityClass
- class of entityentityId
- entity id- Throws:
IllegalArgumentException
- if the entity not found
-
get
public <T> T get(T prototype) Returns the entity if it exists in the set.- Parameters:
prototype
- a prototype instance whose class and id are used to look up an entity in the set.- Throws:
IllegalArgumentException
- if the entity not found
-
getAll
Returns a collection of entities of the specified class.- Parameters:
entityClass
- class of entities
-
delegate
- Specified by:
delegate
in classcom.google.common.collect.ForwardingSet<Object>
-