public final class CompositeCollection extends SemiPersistent<CompositeCollection>
DISCLAIMER This collection must never be used by clients directly! Use it only to implement custom collections and snapshots.
| Constructor and Description |
|---|
CompositeCollection(SemiPersistent... references)
Creates a new
CompositeCollection with given references. |
| Modifier and Type | Method and Description |
|---|---|
CompositeCollection |
cleanCopy()
Creates a new transactional entity from the current one discarding all the local changes.
|
CompositeCollection |
commit(CompositeCollection globalState) |
CompositeCollection |
dirtyCopy()
Copies references to the source data along with local changes and read/write logs.
|
<T extends SemiPersistent> |
get(int idx)
Returns a transactional reference or collection with the give index.
|
void |
update(CompositeCollection changes,
boolean onlyReadLogs)
Updates local changes and change logs using change logs of the arguments.
|
public CompositeCollection(SemiPersistent... references)
CompositeCollection with given references.references - Transactional references or collections. Elements cannot be null.public final CompositeCollection cleanCopy()
cleanCopy in class SemiPersistent<CompositeCollection>public final CompositeCollection dirtyCopy()
SemiPersistent#update(Object) will not work. dirtyCopy in class SemiPersistent<CompositeCollection>public void update(CompositeCollection changes, boolean onlyReadLogs)
SemiPersistent.dirtyCopy(). update in class SemiPersistent<CompositeCollection>changes - The branched collection possibly with updates.onlyReadLogs - If true only read logs are updated. Useful for read-only transactions.public final CompositeCollection commit(CompositeCollection globalState)
public final <T extends SemiPersistent> T get(int idx)
Note: Be very careful with this method! Due to the way generics are implemented in Java, no real type checking is performed. This method silently casts element to the desired type.
See the example below, both lines of code are getting element number zero from the same collection, none of them will be statically checked by the compiler , but it is certain that in runtime at least one of them is due to fail.
TransactionalRef<Integer> ref = compositeCollection.get(0); TransactionalMap<Integer, Double> map = compositeCollection.get(0);
T - The desired type of the resulting value.idx - The index.Copyright © 2013 CERN, The European Organization for Nuclear Research. All Rights Reserved.