|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface WTCollection
A Collection that provides QueryKey, WTReference, and Persistable-based
views of its data.
WTCollections can be optimally refreshed using the CollectionsManager
refresh API.
Supported API: true
Extendable: false
CollectionsManager,
Collection| 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,
boolean add_if_not_present)
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,
boolean add_if_not_present)
Connects the given object from 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 |
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 |
queryKeyIterator()
Returns an iterator over the QueryKeys in this collection. |
Iterator |
referenceIterator()
Returns an Iterator over the objects in this collection, as WTReferences. |
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. |
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 |
| Method Detail |
|---|
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 Collectiono -
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.boolean add(Persistable p)
add(Object)
for documentation for this method.
p -
boolean add(QueryKey query_key)
add(Object)
for documentation for this method.
query_key -
boolean add(WTReference ref)
add(Object)
for documentation for this method.
ref -
boolean addAll(Collection c)
add(Object)
for documentation for this method.
addAll in interface Collectionc -
boolean addAll(QueryResult qr)
qr -
IllegalArgumentException - If the elements in the QueryResult
are not one of he following types:
Iterator classIterator()
ConcurrentModificationException - If the collection is modified
while the iterator is being processed.
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)
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)
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)
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.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 Collectiono -
boolean contains(Persistable p)
contains(Object) for further documentation.
p -
boolean contains(QueryKey query_key)
contains(Object) for further documentation.
query_key -
boolean contains(WTReference ref)
contains(Object) for further documentation.
ref -
boolean containsInstance(Class filter)
filter -
boolean containsOnly(Class filter)
filter -
void deflate()
int getKeyMask()
CollectionsHelper.OBJECT_IDENTIFIER,
CollectionsHelper.VERSION_FOREIGN_KEY
void inflate()
throws WTException
WTExceptionboolean isEnabled(int mask)
mask -
getKeyMask()Iterator iterator()
referenceIterator() API.
iterator in interface Collectioniterator in interface IterableConcurrentModificationException - If the collection is modified
while the iterator is being processed.Collection persistableCollection()
The resulting collection is backed by this collection, so changes
to one are reflected in the other.
Supported API: true
Iterator persistableIterator()
throws WTException
ConcurrentModificationException - If the collection is modified
while the iterator is being processed.
WTExceptionIterator queryKeyIterator()
ConcurrentModificationException - If the collection is modified
while the iterator is being processed.Iterator referenceIterator()
ConcurrentModificationException - If the collection is modified
while the iterator is being processed.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 Collectiono -
boolean remove(Persistable p)
remove(Object)
for further documentation. Removes the object from this collection.
See remove(Object) for further documentation.
p -
boolean remove(QueryKey query_key)
remove(Object)
for further documentation. See remove(Object) for further
documentation.
query_key -
boolean remove(WTReference ref)
remove(Object)
for further documentation. See remove(Object) for further
documentation.
ref -
boolean removeAll(Class filter,
boolean include_subclasses)
filter - include_subclasses -
boolean retainAll(Class filter,
boolean include_subclasses)
filter - include_subclasses -
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 filterObject[] toArray()
toArray in interface CollectionObject[] toArray(Object[] array)
toArray in interface Collectionarray -
Persistable[] toArray(Persistable[] array)
array -
QueryKey[] toArray(QueryKey[] array)
array -
WTReference[] toArray(WTReference[] array)
array -
long[] toArray(long[] array)
array -
long[] toIdArray()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||