|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Collection
that provides QueryKey, WTReference, and Persistable-based
views of its data.
WTCollection
s can be optimally refreshed using the CollectionsManager
refresh API
.
Supported API: true
Extendable: false
CollectionsManager
,
Collection
Field Summary | |
static String |
DEFLATED_ON_SERIALIZATION
Label for the attribute; When true , this collection only
serializes QueryKeys for objects that have them. |
Method Summary | |
boolean |
add(Object o)
Adds the given QueryKey, WTReference, Persistable or collection thereof. |
boolean |
add(Persistable p)
Adds the given object to this collection. |
boolean |
add(QueryKey query_key)
Adds the given object to this collection. |
boolean |
add(WTReference ref)
Adds the given object to this collection. |
boolean |
addAll(Collection c)
Adds the given collection of objects to this collection. |
boolean |
addAll(QueryResult qr)
Adds the contents of a QueryResult to this collection. |
Iterator |
classIterator()
Returns an iterator over the classes that have instances in this collection. |
boolean |
connect(Persistable p,
WTCollection source)
Connects the given object from the source collection to this collection. |
boolean |
connect(Persistable p,
WTCollection source,
boolean add_if_not_present)
Connects the given object from the source collection to this collection. |
boolean |
connect(QueryKey query_key,
WTCollection source)
Connects the given object from the source collection to this collection. |
boolean |
connect(QueryKey query_key,
WTCollection source,
boolean add_if_not_present)
Connects the given object from the source collection to this collection. |
boolean |
connect(WTReference ref,
WTCollection source)
Connects the given object from the source collection to this collection. |
boolean |
connect(WTReference ref,
WTCollection source,
boolean add_if_not_present)
Connects the given object from the source collection to this collection. |
boolean |
connectAll(WTCollection source)
Connects the elements in the source collection to this collection. |
boolean |
connectAll(WTCollection source,
boolean add_if_not_present)
Connects the elements in the source collection to this collection. |
boolean |
contains(Object o)
Returns true if the collection contains the given QueryKey, WTReference, or Persistable, in any form. |
boolean |
contains(Persistable p)
Determines if the collection contains the given object in some form. |
boolean |
contains(QueryKey query_key)
Determines if the collection contains the given object in some form. |
boolean |
contains(WTReference ref)
Determines if the collection contains the given object in some form. |
boolean |
containsInstance(Class filter)
Returns true if there is at least one object in the collection that the filter class is assignable from. |
boolean |
containsOnly(Class filter)
Determines whether this collection only contains objects that are assignable from the given filter. |
void |
deflate()
Dereferences all Persistables in this collection that have QueryKeys. |
int |
getKeyMask()
Returns this collection's key mask. |
void |
inflate()
Retrieves the full persistables for any objects in this collection that currently only have QueryKeys or WTReferences. |
boolean |
isDeflatedOnSerialization()
Gets the value of the attribute: DEFLATED_ON_SERIALIZATION. |
boolean |
isEnabled(int mask)
Returns true if the key types in the given mask are enabled for this collection. |
Iterator |
iterator()
Returns an iterator over the references in the collection, per the contract of the referenceIterator() API. |
Collection |
persistableCollection()
Provides a Persistable-based view of the objects in this WTCollection. |
Iterator |
persistableIterator()
Returns an iterator over the objects in this collection, as Persistables. |
Iterator |
persistableIterator(Class filter,
boolean include_subclasses)
Refines persistableIterator() to only return objects that are either direct or descendent instances of the filter class, depending on the value of include_subclasses. |
Iterator |
queryKeyIterator()
Returns an iterator over the QueryKeys in this collection. |
Iterator |
queryKeyIterator(Class filter,
boolean include_subclasses)
Refines queryKeyIterator() to only return keys that are either direct or descendent instances of the filter class, depending on the value of include_subclasses. |
Iterator |
referenceIterator()
Returns an Iterator over the objects in this collection, as WTReferences. |
Iterator |
referenceIterator(Class filter,
boolean include_subclasses)
Refines referenceIterator() to only return references that are either direct or descendent instances of the filter class, depending on the value of include_subclasses. |
boolean |
remove(Object o)
Removes any form of the object in the collection. |
boolean |
remove(Persistable p)
Removes the object from this collection. |
boolean |
remove(QueryKey query_key)
Removes the object from this collection. |
boolean |
remove(WTReference ref)
Removes the object from this collection. |
boolean |
removeAll(Class filter,
boolean include_subclasses)
Removes all objects in this collection that are assignable from the given class. |
boolean |
retainAll(Class filter,
boolean include_subclasses)
Removes all objects in this collection that are not assignable from the given class. |
void |
setDeflatedOnSerialization(boolean a_DeflatedOnSerialization)
Sets the value of the attribute: DEFLATED_ON_SERIALIZATION. |
WTCollection |
subCollection(Class filter)
Returns a WTCollection containing the objects in this collection that are assignable from the given filter class. |
WTCollection |
subCollection(Class filter,
boolean include_subclasses)
Returns a sub collection of all the objects in this collection that are either direct or descendent instances of the filter class, depending on the value of include_subclasses. |
Object[] |
toArray()
Returns an object array filled with WTReferences to all the objects in this collection. |
long[] |
toArray(long[] array)
Fills the given array with the long ids from each QueryKey in this collection. |
Object[] |
toArray(Object[] array)
Fills the given array with the objects in this collection. |
Persistable[] |
toArray(Persistable[] array)
Fills the given array with the Persistables in this collection. |
QueryKey[] |
toArray(QueryKey[] array)
Fills the given array with the QueryKeys in this collection. |
WTReference[] |
toArray(WTReference[] array)
Fills the given array with WTReferences to all the objects in this collection. |
long[] |
toIdArray()
Returns an array with the long ids from each QueryKey in this collection. |
Methods inherited from interface java.util.Collection |
clear, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, size |
Field Detail |
public static final String DEFLATED_ON_SERIALIZATION
true
, this collection only
serializes QueryKeys for objects that have them. Objects without QueryKeys
are still serialized. This property defaults to false and is transient
to force callers to explicitly enable it, to avoid unintentional deflations.
Method Detail |
public boolean isDeflatedOnSerialization()
true
, this collection only serializes QueryKeys
for objects that have them. Objects without QueryKeys are still serialized.
This property defaults to false and is transient to force callers
to explicitly enable it, to avoid unintentional deflations.
WTPropertyVetoException
- If the setter is called on a subcollectionpublic void setDeflatedOnSerialization(boolean a_DeflatedOnSerialization) throws WTPropertyVetoException
true
, this collection only serializes QueryKeys
for objects that have them. Objects without QueryKeys are still serialized.
This property defaults to false and is transient to force callers
to explicitly enable it, to avoid unintentional deflations.
a_DeflatedOnSerialization
-
WTPropertyVetoException
- If the setter is called on a subcollection
WTPropertyVetoException
public boolean add(Object o)
The persistable and reference versions of add will also add the given
object's QueryKey to the collection, if the object is persisted.
Supported API: true
add
in interface Collection
o
-
ClassCastException
- If a QueryKey or WTReference is added that
doesn't match the collection's key mask. By default, only accepts
ObjectIdentifiers and ObjectReferences. However, if the collection
has the CollectionsHelper.VERSION_FOREIGN_KEY
key type enabled,
then only VersionForeignKeys and VersionReferences are accepted for
Iterated objects. For other object types, ObjectIdentifiers and ObjectReferences
are still accepted. The enabled key types are determined by calling
the isEnabled(int)
method.
ClassCastException
- If a WTReference is added that isn't the
best match for a given object type. For example, AdminDomainRef should
be used when adding a reference to an AdministrativeDomain, rather
than ObjectReference. The appropriate reference type may change depending
upon the collection's key type - WTParts, for example, should be added
by ObjectReference with the default key type, but by VersionReference
when the VERSION_FOREIGN_KEY type is enabled.public boolean add(Persistable p)
add(Object)
for documentation for this method.
p
-
public boolean add(QueryKey query_key)
add(Object)
for documentation for this method.
query_key
-
public boolean add(WTReference ref)
add(Object)
for documentation for this method.
ref
-
public boolean addAll(Collection c)
add(Object)
for documentation for this method.
addAll
in interface Collection
c
-
public boolean addAll(QueryResult qr)
qr
-
IllegalArgumentException
- If the elements in the QueryResult
are not one of he following types:
public Iterator classIterator()
ConcurrentModificationException
- If the collection is modified
while the iterator is being processed.public boolean connect(Persistable p, WTCollection source)
p
- source
-
IllegalArgumentException
- If the source does not have the same
key type as this collection
ClassCastException
- If this collection does not support connection
with the source's implementation of WTCollection.connect(Persistable,WTCollection,boolean)
public boolean connect(QueryKey query_key, WTCollection source)
query_key
- source
-
IllegalArgumentException
- If the source does not have the same
key type as this collection
ClassCastException
- If this collection does not support connection
with the source's implementation of WTCollection.connect(QueryKey,WTCollection,boolean)
public boolean connect(WTReference ref, WTCollection source)
ref
- source
-
IllegalArgumentException
- If the source does not have the same
key type as this collection
ClassCastException
- If this collection does not support connection
with the source's implementation of WTCollection.connect(WTReference,WTCollection,boolean)
public boolean connectAll(WTCollection source)
source
-
IllegalArgumentException
- If connect is true and source does
not have the same key type as this collection
ClassCastException
- If this collection does not support connection
with the source''s implementation of WTCollection.public boolean connect(Persistable p, WTCollection source, boolean add_if_not_present)
add_if_not_present
is true
, then if the object does not exist yet in this
collection, it is added to it.
p
- source
- add_if_not_present
- When true
, the object is added to this collection if it isn't currently contained by it.
IllegalArgumentException
- If the source does not have the same
key type as this collection
ClassCastException
- If this collection does not support connection
with the source's implementation of WTCollection.connect(Persistable,WTCollection,boolean)
public boolean connect(QueryKey query_key, WTCollection source, boolean add_if_not_present)
add_if_not_present
is true
, then if the object does not exist yet in this
collection, it is added to it.
query_key
- source
- add_if_not_present
- When true
, the object is added to this collection if it isn't currently contained by it.
IllegalArgumentException
- If the source does not have the same
key type as this collection
ClassCastException
- If this collection does not support connection
with the source's implementation of WTCollection.connect(QueryKey,WTCollection,boolean)
public boolean connect(WTReference ref, WTCollection source, boolean add_if_not_present)
add_if_not_present
is true
, then if the object does not exist yet in this
collection, it is added to it.
ref
- source
- add_if_not_present
- When true
, the object is added to this collection if it isn't currently contained by it.
IllegalArgumentException
- If the source does not have the same
key type as this collection
ClassCastException
- If this collection does not support connection
with the source's implementation of WTCollection.connect(WTReference,WTCollection,boolean)
public boolean connectAll(WTCollection source, boolean add_if_not_present)
add_if_not_present
is true
, all of the objects in the source collection
are added to this collection.
source
- add_if_not_present
- When true
, objects in source that aren't currently in this collection are added to this collection.
IllegalArgumentException
- If connect is true and source does
not have the same key type as this collection
ClassCastException
- If this collection does not support connection
with the source''s implementation of WTCollection.public boolean contains(Object o)
Contains is overloaded with type-specific methods to allow callers
to avoid the overhead of an instanceof check. The generic contains()
delegates to the appropriate type-specific one.
Supported API: true
contains
in interface Collection
o
-
public boolean contains(Persistable p)
contains(Object)
for further documentation.
p
-
public boolean contains(QueryKey query_key)
contains(Object)
for further documentation.
query_key
-
public boolean contains(WTReference ref)
contains(Object)
for further documentation.
ref
-
public boolean containsInstance(Class filter)
filter
-
public boolean containsOnly(Class filter)
filter
-
public void deflate()
public int getKeyMask()
CollectionsHelper.OBJECT_IDENTIFIER
,
CollectionsHelper.VERSION_FOREIGN_KEY
public void inflate() throws WTException
WTException
public boolean isEnabled(int mask)
mask
-
getKeyMask()
public Iterator iterator()
referenceIterator()
API.
iterator
in interface Collection
ConcurrentModificationException
- If the collection is modified
while the iterator is being processed.public Collection persistableCollection()
The resulting collection is backed by this collection, so changes
to one are reflected in the other.
Supported API: true
public Iterator persistableIterator() throws WTException
ConcurrentModificationException
- If the collection is modified
while the iterator is being processed.
WTException
public Iterator persistableIterator(Class filter, boolean include_subclasses) throws WTException
If a refresh is necessary, implementations should only refresh objects
of the given filter class, rather than all the objects in the collection.
Supported API: false
filter
- include_subclasses
-
ConcurrentModificationException
- If the collection is modified
while the iterator is being processed.
WTException
persistableIterator()
public Iterator queryKeyIterator()
ConcurrentModificationException
- If the collection is modified
while the iterator is being processed.public Iterator queryKeyIterator(Class filter, boolean include_subclasses)
filter
- include_subclasses
-
ConcurrentModificationException
- If the collection is modified
while the iterator is being processed.queryKeyIterator()
public Iterator referenceIterator()
ConcurrentModificationException
- If the collection is modified
while the iterator is being processed.public Iterator referenceIterator(Class filter, boolean include_subclasses)
filter
- include_subclasses
-
ConcurrentModificationException
- If the collection is modified
while the iterator is being processed.queryKeyIterator()
public boolean remove(Object o)
Remove is overloaded with type-specific methods to allow callers to
avoid the overhead of an instanceof check. The generic remove() delegates
to the appropriate type-specific one.
Supported API: true
remove
in interface Collection
o
-
public boolean remove(Persistable p)
remove(Object)
for further documentation. Removes the object from this collection.
See remove(Object)
for further documentation.
p
-
public boolean remove(QueryKey query_key)
remove(Object)
for further documentation. See remove(Object)
for further
documentation.
query_key
-
public boolean remove(WTReference ref)
remove(Object)
for further documentation. See remove(Object)
for further
documentation.
ref
-
public boolean removeAll(Class filter, boolean include_subclasses)
filter
- include_subclasses
-
public boolean retainAll(Class filter, boolean include_subclasses)
filter
- include_subclasses
-
public WTCollection subCollection(Class filter)
subCollection(Class,
boolean)
for further documentation.
filter
-
public WTCollection subCollection(Class filter, boolean include_subclasses)
filter
- include_subclasses
-
ClassCastException
- If an attempt is made to add an object
that is not assignable from the subcollection's filterpublic Object[] toArray()
toArray
in interface Collection
public Object[] toArray(Object[] array)
toArray
in interface Collection
array
-
public Persistable[] toArray(Persistable[] array)
array
-
public QueryKey[] toArray(QueryKey[] array)
array
-
public WTReference[] toArray(WTReference[] array)
array
-
public long[] toArray(long[] array)
array
-
public long[] toIdArray()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |