Class WTArrayList
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,Iterable,Collection,List,SequencedCollection,wt.fc.collections.ReferenceBased,WTCollection,WTList,ResultProcessor,Evolvable
WTArrayList implements wt.fc.ResultProcessor to provide better integration with the persistence layer. By implementing ResultProcessor, the default collections can be used in place of a QueryResult when retrieving data. The APIs to accomplish this are:
PersistenceManager.find(StatementSpec, ResultProcessor) PersisenceManagerSvr.query(StatementSpec, ResultProcessor)
In addition to a no-arg clone method, WTArrayList provides a "deep" clone in which the references are copied and the Persistables in the set are cloned using PersistenceCloner.
A WTArrayList can be constructed with a key mask. The default key mask is CollectionsHelper.OBJECT_IDENTIFIER.
Note: this class is Evolvable. You probably don't want to take
advantage of this, though, because what you've really got is an
association and you should just accept that, model it, and let the system
handle data integrity for you. But, if you ignore this advice, be aware
that only the references themselves (and not their persistables) will be
blobbed (unless the object hasn't been persisted, in which case
it'll attempt to blob the entire persistable and fail (unless the
persistable itself is Evolvable)) and that nobody's guaranteeing the
objects being referred to will still be around when you later de-blob the
collection and attempt to inflate the references.
Supported API: true
Extendable: false
- See Also:
-
Field Summary
Fields inherited from interface wt.fc.collections.WTCollection
DEFLATED_ON_SERIALIZATION -
Constructor Summary
ConstructorsConstructorDescription
Supported API: trueWTArrayList(int initial_capacity)
Supported API: trueWTArrayList(int initial_capacity, int key_mask)
Supported API: true
Supported API: trueWTArrayList(Collection c, int key_mask)
Supported API: true -
Method Summary
Modifier and TypeMethodDescriptionclone()
Supported API: trueclone(boolean deep)
Supported API: trueReturns an iterator over the objects in this collection, as Persistables.Returns an iterator over the QueryKeys in this collection.Returns an Iterator over the objects in this collection, as WTReferences.Methods inherited from class wt.fc.collections.AbstractWTList
add, add, add, add, add, add, addAll, addAll, connect, connect, connect, connectAll, equals, get, indexOf, indexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, persistableListIterator, queryKeyListIterator, referenceListIterator, remove, set, set, setMethods inherited from class wt.fc.collections.AbstractWTCollection
add, addAll, connect, connect, connect, connect, connect, connect, connectAll, connectAll, contains, contains, contains, contains, containsInstance, containsNonPersisted, containsOnly, deflate, getLastReturnedReference, getReference, getReference, getReference, getReferences, hashCode, inflate, isEnabled, iterator, persistableCollection, remove, remove, remove, remove, removeAll, removeAll, removeNonPersisted, retainAll, setLastReturnedReference, subCollection, toArray, toArray, toArray, toArray, toArray, toArray, toIdArrayMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, retainAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
add, addFirst, addLast, contains, containsAll, getFirst, getLast, hashCode, isEmpty, iterator, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray, toArrayMethods inherited from interface wt.fc.collections.WTCollection
add, addAll, connect, connect, connect, connectAll, connectAll, contains, contains, contains, contains, containsInstance, containsOnly, deflate, inflate, isEnabled, iterator, persistableCollection, remove, remove, remove, remove, removeAll, retainAll, subCollection, toArray, toArray, toArray, toArray, toArray, toArray, toIdArray
-
Constructor Details
-
WTArrayList
public WTArrayList()
Supported API: true -
WTArrayList
public WTArrayList(int initial_capacity)
Supported API: true- Parameters:
initial_capacity-
-
WTArrayList
public WTArrayList(int initial_capacity, int key_mask)
Supported API: true- Parameters:
initial_capacity-key_mask-
-
WTArrayList
Supported API: true- Parameters:
c-
-
WTArrayList
Supported API: true- Parameters:
c-key_mask-
-
-
Method Details
-
clone
Supported API: true -
clone
Supported API: true- Parameters:
deep-- Returns:
- WTArrayList
-
persistableIterator
Returns an iterator over the objects in this collection, as Persistables. Inflates all the QueryKeys and references in this collection that don't have Persistables yet. Persistables that are already in the collection are not refreshed.
Supported API: true- Specified by:
persistableIteratorin interfaceWTCollection- Specified by:
persistableIteratorin classwt.fc.collections.AbstractWTCollection- Returns:
- An iterator of Persistables
- Throws:
ConcurrentModificationException- If the collection is modified while the iterator is being processed.WTException
-
queryKeyIterator
Returns an iterator over the QueryKeys in this collection. These will typically be ObjectIdentifiers, but may be other QueryKey types depending on how the collection is constructed. Nonpersisted objects will not be included in the id iterator.
Supported API: true- Specified by:
queryKeyIteratorin interfaceWTCollection- Specified by:
queryKeyIteratorin classwt.fc.collections.AbstractWTCollection- Returns:
- An iterator of QueryKeys
- Throws:
ConcurrentModificationException- If the collection is modified while the iterator is being processed.
-
referenceIterator
Returns an Iterator over the objects in this collection, as WTReferences. The precise subclass of WTReference is determined by the referenced class, and by this collection's key mask. The references in the iterator may or may not be inflated, depending upon how they were added to the collection and when the collection was last refreshed. Non-persisted objects will still have references in the iterator; they will have null keys.
Supported API: true- Specified by:
referenceIteratorin interfaceWTCollection- Specified by:
referenceIteratorin classwt.fc.collections.AbstractWTCollection- Returns:
- An iterator of WTReferences
- Throws:
ConcurrentModificationException- If the collection is modified while the iterator is being processed.
-