public class EntitySet extends com.google.common.collect.ForwardingSet<Entity> implements java.io.Serializable
Set<Entity> with convenient methods for getting entities by a prototype instance
or by a class and id.| Constructor and Description |
|---|
EntitySet() |
EntitySet(java.util.Collection<? extends Entity> entities) |
EntitySet(java.util.Set<? extends Entity> entities) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Set |
delegate() |
<T extends Entity<K>,K> |
get(java.lang.Class<T> entityClass,
K entityId)
Returns the entity if it exists in the set.
|
<T extends Entity> |
get(T prototype)
Returns the entity if it exists in the set.
|
static EntitySet |
of(java.util.Collection<? extends Entity> entities)
Creates the
EntitySet by copying the given collection to the internal set. |
static EntitySet |
of(java.util.Set<? extends Entity> entities)
Creates the
EntitySet wrapping an existing set. |
<T extends Entity<K>,K> |
optional(java.lang.Class<T> entityClass,
K entityId)
Returns the entity wrapped in
Optional if it exists in the set. |
<T extends Entity> |
optional(T prototype)
Returns the entity wrapped in
Optional if it exists in the set. |
equals, hashCode, standardEquals, standardHashCode, standardRemoveAlladd, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic EntitySet()
public EntitySet(java.util.Set<? extends Entity> entities)
public EntitySet(java.util.Collection<? extends Entity> entities)
public static EntitySet of(java.util.Set<? extends Entity> entities)
EntitySet wrapping an existing set.public static EntitySet of(java.util.Collection<? extends Entity> entities)
EntitySet by copying the given collection to the internal set.public <T extends Entity<K>,K> java.util.Optional<T> optional(java.lang.Class<T> entityClass, K entityId)
Optional if it exists in the set.entityClass - class of entityentityId - entity idpublic <T extends Entity> java.util.Optional<T> optional(T prototype)
Optional if it exists in the set.prototype - a prototype instance whose class and id are used to look up an entity in the set.public <T extends Entity<K>,K> T get(java.lang.Class<T> entityClass, K entityId)
entityClass - class of entityentityId - entity idjava.lang.IllegalArgumentException - if the entity not foundpublic <T extends Entity> T get(T prototype)
prototype - a prototype instance whose class and id are used to look up an entity in the set.java.lang.IllegalArgumentException - if the entity not foundprotected java.util.Set delegate()
delegate in class com.google.common.collect.ForwardingSet<Entity>