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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Setdelegate()<T> TReturns the entity if it exists in the set.<T> Tget(T prototype) Returns the entity if it exists in the set.<T> Collection<T>Returns a collection of entities of the specified class.static EntitySetof(Collection<?> entities) Creates theEntitySetby copying the given collection to the internal set.static EntitySetCreates theEntitySetwrapping an existing set.<T> Optional<T>Returns the entity wrapped inOptionalif it exists in the set.<T> Optional<T>optional(T prototype) Returns the entity wrapped inOptionalif it exists in the set.Methods inherited from class com.google.common.collect.ForwardingSet
equals, hashCode, standardEquals, standardHashCode, standardRemoveAllMethods 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, toArrayMethods inherited from class com.google.common.collect.ForwardingObject
toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
EntitySet
public EntitySet() -
EntitySet
-
EntitySet
-
-
Method Details
-
of
Creates theEntitySetwrapping an existing set. -
of
Creates theEntitySetby copying the given collection to the internal set. -
optional
Returns the entity wrapped inOptionalif it exists in the set.- Parameters:
entityClass- class of entityentityId- entity id
-
optional
Returns the entity wrapped inOptionalif 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:
delegatein classcom.google.common.collect.ForwardingSet<Object>
-