public class ManyAssociationWrapper extends Object implements ManyAssociation<Object>
Modifier and Type | Field and Description |
---|---|
protected ManyAssociation<Object> |
next |
Constructor and Description |
---|
ManyAssociationWrapper(ManyAssociation<Object> next) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(int i,
Object entity)
Adds an entity reference representing the given entity to the
index slot of this collection. |
boolean |
add(Object entity)
Adds an entity reference representing the given entity to the end of this collection.
|
boolean |
clear()
Clear all entities from this
ManyAssociation . |
boolean |
contains(Object entity)
Check is the entity is part of this
ManyAssociation . |
int |
count()
Returns the number of references in this association.
|
boolean |
equals(Object obj) |
Object |
get(int i)
Fetch the entity refrence at the given index and fetch the entity from the entity store.
|
int |
hashCode() |
Iterator<Object> |
iterator() |
ManyAssociation<Object> |
next() |
Stream<EntityReference> |
references()
Returns a stream of the references to the associated entities.
|
boolean |
remove(Object entity)
Removes the given entity from this
ManyAssociation . |
List<Object> |
toList()
Fetches all entities represented by entity references in this collection and returns a List of such
entities.
|
Set<Object> |
toSet()
Fetches all entities represented by entity references in this collection and returns a Set of such
entities.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected ManyAssociation<Object> next
public ManyAssociationWrapper(ManyAssociation<Object> next)
public ManyAssociation<Object> next()
public int count()
ManyAssociation
count
in interface ManyAssociation<Object>
public boolean contains(Object entity)
ManyAssociation
ManyAssociation
.contains
in interface ManyAssociation<Object>
entity
- The entity to be checking for.Identity
as the given
entity , otherwise false.public boolean add(int i, Object entity)
ManyAssociation
index
slot of this collection.
index=0
represents the beginning of the collection and if the index
is equal or larger
than the length of the collection, the entity reference will be added to the end.
add
in interface ManyAssociation<Object>
i
- the position for the entity to be inserted at, starting at 0. If index is larger than number
of references present, then it will be added to the end. If index is smaller than 0, then it
will be added at the beginning, position 0.entity
- The entity whose entity reference is to be added to this collection.public boolean add(Object entity)
ManyAssociation
add
in interface ManyAssociation<Object>
entity
- The entity whose entity reference is to be added to this collection.public boolean remove(Object entity)
ManyAssociation
ManyAssociation
.
The entity reference representing the given entity is removed from this collection.
remove
in interface ManyAssociation<Object>
entity
- The entity reference to be removed.public boolean clear()
ManyAssociation
ManyAssociation
.
All entity references present is removed from this collection.
clear
in interface ManyAssociation<Object>
public Object get(int i)
ManyAssociation
get
in interface ManyAssociation<Object>
i
- The index location in the collection of the entity reference to be fetched.public List<Object> toList()
ManyAssociation
Multiple references to the same entity will be present multiple times in the List, unlike ManyAssociation.toSet()
.
The order in which the entities were added to this collection is preserved.
toList
in interface ManyAssociation<Object>
public Set<Object> toSet()
ManyAssociation
Multiple references to the same entity will NOT be present, unlike ManyAssociation.toList()
. Sets are defined
to only contain any particular object once. Order is not preserved.
toSet
in interface ManyAssociation<Object>
public Stream<EntityReference> references()
ManyAssociation
references
in interface ManyAssociation<Object>