|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
com.linkedin.data.collections.CheckedList<java.lang.Object>
com.linkedin.data.DataList
public final class DataList
A DataList is ordered list of Data objects.
When an value is being added or replaced on the list, the list
will verify that the value is a Data object. If the value
is not a Data object, then the list will throw an IllegalArgumentException
.
Cloning via the clone()
method will shallow copy the DataList
and will not deep copy contained complex objects. Copying via the copy()
method will deep copy the DataList
, which includes deep copying the
contained complex objects.
Instrumentation if enabled is only enabled for the DataList
and not
for the underlying CheckedList
. Furthermore, if a DataList
is cloned,
the clone will not have instrumentation enabled and the clone's instrumented
data will be cleared.
Since DataList
extends CheckedList
, copying of the DataList
is lazy and may be delayed until the DataList
is about to be modified.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Fields inherited from interface com.linkedin.data.Instrumentable |
---|
TIMES_ACCESSED, VALUE |
Constructor Summary | |
---|---|
DataList()
Construct an empty DataList . |
|
DataList(int initialCapacity)
Construct a DataList with the specified initial capacity. |
|
DataList(java.util.List<? extends java.lang.Object> list)
Construct a DataList with Data objects provided by the input list. |
Method Summary | |
---|---|
void |
clearInstrumentedData()
Clear tracked data. |
DataList |
clone()
Shallow clone. |
void |
collectInstrumentedData(java.lang.StringBuilder keyPrefix,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> instrumentedData,
boolean collectAllData)
Collect either all the data in this and contained Instrumentable or only the keys
or indices that have been marked as accessed depending on the collectAllData flag. |
DataList |
copy()
Deep copy. |
void |
copyReferencedObjects(java.util.IdentityHashMap<DataComplex,DataComplex> alreadyCopied)
Deep copy this object and the complex Data objects referenced by this object. |
java.lang.Object |
get(int index)
|
DataList |
getDataList(int index)
Returns the element at the specified position cast to a DataList . |
DataMap |
getDataMap(int index)
Returns the element at the specified position cast to a DataMap . |
boolean |
isMadeReadOnly()
Whether this object and recursively contained complex objects are read-only. |
void |
makeReadOnly()
Make read-only this object and recursively contained complex objects. |
void |
startInstrumentingAccess()
Sets the state of this Instrumentable to start instrumenting data access. |
void |
stopInstrumentingAccess()
Sets the state of this Instrumentable to stop instrumenting data access. |
java.util.Collection<java.lang.Object> |
values()
Return the collection of values in this complex object. |
Methods inherited from class com.linkedin.data.collections.CheckedList |
---|
add, add, addAll, addAll, addWithoutChecking, clear, contains, containsAll, equals, getObject, hashCode, indexOf, invalidate, isEmpty, isReadOnly, lastIndexOf, remove, remove, removeAll, removeRange, retainAll, set, setReadOnly, setWithoutChecking, size, toArray, toArray, toString |
Methods inherited from class java.util.AbstractList |
---|
iterator, listIterator, listIterator, subList |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.linkedin.data.collections.Common |
---|
invalidate, isReadOnly, setReadOnly |
Methods inherited from interface java.util.List |
---|
iterator, listIterator, listIterator, subList |
Constructor Detail |
---|
public DataList()
DataList
.
public DataList(java.util.List<? extends java.lang.Object> list)
DataList
with Data objects provided by the input list.
list
- provides the initial Data objects in the constructed list.public DataList(int initialCapacity)
DataList
with the specified initial capacity.
initialCapacity
- provides the initial capacity of the DataList
.Method Detail |
---|
public java.lang.Object get(int index)
get
in interface java.util.List<java.lang.Object>
get
in class CheckedList<java.lang.Object>
public DataList clone() throws java.lang.CloneNotSupportedException
Common
clone
in interface Common
clone
in interface CommonList<java.lang.Object>
clone
in interface DataComplex
clone
in class CheckedList<java.lang.Object>
java.lang.CloneNotSupportedException
- if the object cannot be shallow copied.public DataList copy() throws java.lang.CloneNotSupportedException
DataComplex
copy
in interface DataComplex
java.lang.CloneNotSupportedException
- if the object cannot be deep copied.public void copyReferencedObjects(java.util.IdentityHashMap<DataComplex,DataComplex> alreadyCopied) throws java.lang.CloneNotSupportedException
DataComplex
copyReferencedObjects
in interface DataComplex
alreadyCopied
- provides the objects already copied, and their copies.
java.lang.CloneNotSupportedException
- if the referenced object cannot be copied.public java.util.Collection<java.lang.Object> values()
DataComplex
values
in interface DataComplex
public void makeReadOnly()
DataComplex
makeReadOnly
in interface DataComplex
public boolean isMadeReadOnly()
DataComplex
isMadeReadOnly
in interface DataComplex
public DataList getDataList(int index)
DataList
.
index
- of the element to return.
DataList
.public DataMap getDataMap(int index)
DataMap
.
index
- of the element to return.
DataMap
.public void startInstrumentingAccess()
Instrumentable
Instrumentable
to start instrumenting data access.
The types of accesses that are instrumented depends on the actual concrete classes
that implement this interface. The minimum expectation is that read access via
Collection#get
, Map#get
, and Map.containsKey(Object)
are instrumented as an access.
startInstrumentingAccess
in interface Instrumentable
public void stopInstrumentingAccess()
Instrumentable
Instrumentable
to stop instrumenting data access.
stopInstrumentingAccess
in interface Instrumentable
public void clearInstrumentedData()
Instrumentable
clearInstrumentedData
in interface Instrumentable
public void collectInstrumentedData(java.lang.StringBuilder keyPrefix, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> instrumentedData, boolean collectAllData)
Instrumentable
Instrumentable
or only the keys
or indices that have been marked as accessed depending on the collectAllData
flag.
The data is collected into the instrumentedData
supplied. Each entry's key in
the instrumentedData
map is the fully qualified name of the accessed key or index.
The fully qualified name is constructed by pre-pending the provided keyPrefix
and the keys and indices of antecedent objects traversed to reach this particular
key or index. Each entry's value in the instrumentedData
map is another map.
The minimum expectation is that the latter map has at least two entries,
the "value" entry holds the String representation object identified by the fully
qualified name, and the "timesAcessed" entry has the number of times the fully
qualified name has been accessed. The number of times accessed may be null
in
case it is unknown how many times the key or index was accessed due to instrumentation limitations.
collectInstrumentedData
in interface Instrumentable
keyPrefix
- is the prefix to prepend to the fully qualified name of accessed keys and indices.instrumentedData
- provides the map to hold the output of the collected instrumented data, each
map entry's key is the fully qualified name of the key or index accessed, and the
map entry's value is another map that holds collected data.collectAllData
- indicates whether to collect all data in this and contained Instrumentable
or
only the keys or indices accessed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |