public class ArrayOfDataObject<T extends DataObject> extends ArrayDataObject<T>
This subclass of ArrayDataObject provides additional behaviour for the
case where the contained datatype is itself an implementation of DataObject.
It provides 'deep' implementations of clone() and setReadOnly() that act on
the array elements in addition to the array instance itself.
valuemodCount| Constructor and Description |
|---|
ArrayOfDataObject(T[] value)
Constructs from a given initial array value.
|
| Modifier and Type | Method and Description |
|---|---|
ArrayOfDataObject<T> |
clone()
Perform a deep copy of this object.
|
static ArrayOfDataObject<? extends DataObject> |
copyOf(ArrayOfDataObject<?> from)
Creates a new ArrayOfDataObject, initialising its value from that of the given ArrayOfDataObject.
|
void |
setReadOnly()
Set this object to be "read-only".
|
checkModify, copyOf, equals, get, getValue, hashCode, isReadOnly, set, size, toStringadd, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArraypublic ArrayOfDataObject(T[] value)
value - array value; must not be null.public ArrayOfDataObject<T> clone()
DataObjectInherently immutable objects may optionally return the same object without modification from clone(), rather than constructing a new instance.
clone in interface DataObjectclone in class ArrayDataObject<T extends DataObject>public void setReadOnly()
DataObjectNote that a read-only object is not necessarily immutable; if reference types are returned from accessors, then callers could theoretically mutate those objects even if the top-level object is marked as read-only. The ability to make objects read-only is intended to catch programming errors (e.g. attempting to modify a data object passed as part of a SLEE event), not to provide an absolute guarantee of immutability.
Calling setReadOnly() on an object that is already read-only is a no-op.
Some DataObject implementations may be inherently immutable. In those cases, they are considered always read-only.
setReadOnly in interface DataObjectsetReadOnly in class ArrayDataObject<T extends DataObject>public static ArrayOfDataObject<? extends DataObject> copyOf(ArrayOfDataObject<?> from)
from - the object from which to copy