Class StoreListImpl
- All Implemented Interfaces:
ComplexData,StoreList,Iterable<TypedValue<?>>,Collection<TypedValue<?>>,List<TypedValue<?>>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.terracottatech.store.ComplexData
ComplexData.DotSpecParseException -
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionStoreListImpl(com.terracottatech.tcson.MutableSonList mutable) StoreListImpl(com.terracottatech.tcson.MutableSonList list, boolean mutable) StoreListImpl(com.terracottatech.tcson.ReadableSonList list) StoreListImpl(List<TypedValue<?>> incoming) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int index, TypedValue<?> element) booleanadd(TypedValue<?> value) voidclear()booleanDo a filtering find operation across this object based on the Dot Notation given.TypedValue<?>get(int index) inthashCode()hashcode() implementations of Complex list objects do not necessarily adhere to the default Java List contract for hashcode.booleanisEmpty()Is this object empty?booleanIs this a mutable representation?Iterator<TypedValue<?>>iterator()com.terracottatech.tcson.SonList<? extends com.terracottatech.tcson.SonValue>liveList()Make a copy of this instance that is assured to be mutable.TypedValue<?>remove(int index) booleanTypedValue<?>set(int index, TypedValue<?> element) intsize()Size (number of elements) in this object.toString()toString(boolean skipWhitespace) Generate a string representation of this object in the specified format, with the specified compactness.Methods inherited from class java.util.AbstractList
addAll, indexOf, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface com.terracottatech.store.ComplexData
notEmptyMethods inherited from interface java.util.List
addAll, addAll, contains, containsAll, indexOf, lastIndexOf, listIterator, listIterator, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray
-
Constructor Details
-
StoreListImpl
-
StoreListImpl
public StoreListImpl(com.terracottatech.tcson.ReadableSonList list) -
StoreListImpl
public StoreListImpl(com.terracottatech.tcson.MutableSonList mutable) -
StoreListImpl
public StoreListImpl(com.terracottatech.tcson.MutableSonList list, boolean mutable) -
StoreListImpl
public StoreListImpl()
-
-
Method Details
-
find
Description copied from interface:ComplexDataDo a filtering find operation across this object based on the Dot Notation given.Dot notation is fairly simple yet powerful.
- '.' by itself matches the current object.
- '.foo' if the top level object is a map, matches the value of the 'foo' key
- '.foo.bar' matches the top level object as a map, then the value at key 'foo', then matches if that value is a map, then matches the value of its key 'bar'. etc.
- map keys for matching can also be expressed with more explicit
- '.[foo bar].[baz]'
- '.["foo\nbar"].baz'
- '.[1]' matches the list entry at index 1 (lists are zero based)
- '.[1:3]' matches the slice from 1 to 3 inclusive.
- finally, a stanza of '.[].' matches all entries. (wildcard)
This allows for reaching inside a nested complex structure and identifying only those pieces of interest. For example: '.employees.[].[first name]' might reach into a map, grab the list at key 'employees', go through every entry in the list, treat as a map, then grab the value of the 'first name' key in each map, this returning a list of every employee's first name.
- Specified by:
findin interfaceComplexData- Parameters:
dotSpec- dot specification- Returns:
Selectionof matchingTypedValue
-
get
- Specified by:
getin interfaceList<TypedValue<?>>- Specified by:
getin classAbstractList<TypedValue<?>>
-
liveList
public com.terracottatech.tcson.SonList<? extends com.terracottatech.tcson.SonValue> liveList() -
mutableCopy
Description copied from interface:StoreListMake a copy of this instance that is assured to be mutable.- Specified by:
mutableCopyin interfaceComplexData- Specified by:
mutableCopyin interfaceStoreList- Returns:
- mutable copy.
-
isMutable
public boolean isMutable()Description copied from interface:ComplexDataIs this a mutable representation?- Specified by:
isMutablein interfaceComplexData- Returns:
trueif mutable
-
size
public int size()Description copied from interface:ComplexDataSize (number of elements) in this object.- Specified by:
sizein interfaceCollection<TypedValue<?>>- Specified by:
sizein interfaceComplexData- Specified by:
sizein interfaceList<TypedValue<?>>- Specified by:
sizein classAbstractCollection<TypedValue<?>>- Returns:
- number of elements.
-
isEmpty
public boolean isEmpty()Description copied from interface:ComplexDataIs this object empty?- Specified by:
isEmptyin interfaceCollection<TypedValue<?>>- Specified by:
isEmptyin interfaceComplexData- Specified by:
isEmptyin interfaceList<TypedValue<?>>- Overrides:
isEmptyin classAbstractCollection<TypedValue<?>>- Returns:
- true if empty.
-
iterator
- Specified by:
iteratorin interfaceCollection<TypedValue<?>>- Specified by:
iteratorin interfaceIterable<TypedValue<?>>- Specified by:
iteratorin interfaceList<TypedValue<?>>- Overrides:
iteratorin classAbstractList<TypedValue<?>>
-
add
- Specified by:
addin interfaceCollection<TypedValue<?>>- Specified by:
addin interfaceList<TypedValue<?>>- Overrides:
addin classAbstractList<TypedValue<?>>
-
set
- Specified by:
setin interfaceList<TypedValue<?>>- Overrides:
setin classAbstractList<TypedValue<?>>
-
add
- Specified by:
addin interfaceList<TypedValue<?>>- Overrides:
addin classAbstractList<TypedValue<?>>
-
remove
- Specified by:
removein interfaceList<TypedValue<?>>- Overrides:
removein classAbstractList<TypedValue<?>>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<TypedValue<?>>- Specified by:
clearin interfaceList<TypedValue<?>>- Overrides:
clearin classAbstractList<TypedValue<?>>
-
remove
- Specified by:
removein interfaceCollection<TypedValue<?>>- Specified by:
removein interfaceList<TypedValue<?>>- Overrides:
removein classAbstractCollection<TypedValue<?>>
-
equals
- Specified by:
equalsin interfaceCollection<TypedValue<?>>- Specified by:
equalsin interfaceList<TypedValue<?>>- Overrides:
equalsin classAbstractList<TypedValue<?>>
-
hashCode
public int hashCode()Description copied from interface:StoreListhashcode() implementations of Complex list objects do not necessarily adhere to the default Java List contract for hashcode.- Specified by:
hashCodein interfaceCollection<TypedValue<?>>- Specified by:
hashCodein interfaceList<TypedValue<?>>- Specified by:
hashCodein interfaceStoreList- Overrides:
hashCodein classAbstractList<TypedValue<?>>- Returns:
- hashcode.
-
toString
Description copied from interface:ComplexDataGenerate a string representation of this object in the specified format, with the specified compactness.Native format is TC son, which is a more strongly typed version of JSON. Alternatively, the JSON compatible format grinds everything without a JSON type (chars, byte arrays) to strings, and all three numeric types become just JSON numbers.
- Specified by:
toStringin interfaceComplexData- Parameters:
skipWhitespace- line breaks and indention, or not.- Returns:
- String version of this object.
-
toString
- Overrides:
toStringin classAbstractCollection<TypedValue<?>>
-