Class ArrayOfDataObject<T extends DataObject>

  • All Implemented Interfaces:
    DataObject, Serializable, Iterable<T>, Collection<T>, List<T>

    public class ArrayOfDataObject<T extends DataObject>
    extends ArrayDataObject<T>
    An ArrayOfDataObject is a DataObject whose content is an array of DataObjects. It is useful where you need a DataObject as the representation for an ASN.1 SEQUENCE OF or SET OF type, and is used if the extendible adaptation is given.

    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.

    See Also:
    Serialized Form
    • Constructor Detail

      • ArrayOfDataObject

        public ArrayOfDataObject​(T[] value)
        Constructs from a given initial array value.
        Parameters:
        value - array value; must not be null.
    • Method Detail

      • clone

        public ArrayOfDataObject<T> clone()
        Description copied from interface: DataObject
        Perform a deep copy of this object. Read-only state of the object is not copied; the new object will be read-write by default.

        Inherently immutable objects may optionally return the same object without modification from clone(), rather than constructing a new instance.

        Specified by:
        clone in interface DataObject
        Overrides:
        clone in class ArrayDataObject<T extends DataObject>
        Returns:
        a new object that is a deep copy of this object; for immutable objects, the same object may optionally be returned.
      • setReadOnly

        public void setReadOnly()
        Description copied from interface: DataObject
        Set this object to be "read-only". Any subsequent attempt to modify this object will throw IllegalStateException. Once an object has been made read-only, it cannot be later set to read-write - this is a "one-way" operation.

        Note 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.

        Specified by:
        setReadOnly in interface DataObject
        Overrides:
        setReadOnly in class ArrayDataObject<T extends DataObject>
      • copyOf

        public static ArrayOfDataObject<? extends DataObject> copyOf​(ArrayOfDataObject<?> from)
        Creates a new ArrayOfDataObject, initialising its value from that of the given ArrayOfDataObject.
        Parameters:
        from - the object from which to copy
        Returns:
        new ArrayOfDataObject