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 TypeMethodDescriptionvoid
add
(int index, TypedValue<?> element) boolean
add
(TypedValue<?> value) void
clear()
boolean
Do a filtering find operation across this object based on the Dot Notation given.TypedValue<?>
get
(int index) int
hashCode()
hashcode() implementations of Complex list objects do not necessarily adhere to the default Java List contract for hashcode.boolean
isEmpty()
Is this object empty?boolean
Is 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) boolean
TypedValue<?>
set
(int index, TypedValue<?> element) int
size()
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, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, removeAll, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface com.terracottatech.store.ComplexData
notEmpty
Methods 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:ComplexData
Do 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:
find
in interfaceComplexData
- Parameters:
dotSpec
- dot specification- Returns:
Selection
of matchingTypedValue
-
get
- Specified by:
get
in interfaceList<TypedValue<?>>
- Specified by:
get
in classAbstractList<TypedValue<?>>
-
liveList
public com.terracottatech.tcson.SonList<? extends com.terracottatech.tcson.SonValue> liveList() -
mutableCopy
Description copied from interface:StoreList
Make a copy of this instance that is assured to be mutable.- Specified by:
mutableCopy
in interfaceComplexData
- Specified by:
mutableCopy
in interfaceStoreList
- Returns:
- mutable copy.
-
isMutable
public boolean isMutable()Description copied from interface:ComplexData
Is this a mutable representation?- Specified by:
isMutable
in interfaceComplexData
- Returns:
true
if mutable
-
size
public int size()Description copied from interface:ComplexData
Size (number of elements) in this object.- Specified by:
size
in interfaceCollection<TypedValue<?>>
- Specified by:
size
in interfaceComplexData
- Specified by:
size
in interfaceList<TypedValue<?>>
- Specified by:
size
in classAbstractCollection<TypedValue<?>>
- Returns:
- number of elements.
-
isEmpty
public boolean isEmpty()Description copied from interface:ComplexData
Is this object empty?- Specified by:
isEmpty
in interfaceCollection<TypedValue<?>>
- Specified by:
isEmpty
in interfaceComplexData
- Specified by:
isEmpty
in interfaceList<TypedValue<?>>
- Overrides:
isEmpty
in classAbstractCollection<TypedValue<?>>
- Returns:
- true if empty.
-
iterator
- Specified by:
iterator
in interfaceCollection<TypedValue<?>>
- Specified by:
iterator
in interfaceIterable<TypedValue<?>>
- Specified by:
iterator
in interfaceList<TypedValue<?>>
- Overrides:
iterator
in classAbstractList<TypedValue<?>>
-
add
- Specified by:
add
in interfaceCollection<TypedValue<?>>
- Specified by:
add
in interfaceList<TypedValue<?>>
- Overrides:
add
in classAbstractList<TypedValue<?>>
-
set
- Specified by:
set
in interfaceList<TypedValue<?>>
- Overrides:
set
in classAbstractList<TypedValue<?>>
-
add
- Specified by:
add
in interfaceList<TypedValue<?>>
- Overrides:
add
in classAbstractList<TypedValue<?>>
-
remove
- Specified by:
remove
in interfaceList<TypedValue<?>>
- Overrides:
remove
in classAbstractList<TypedValue<?>>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<TypedValue<?>>
- Specified by:
clear
in interfaceList<TypedValue<?>>
- Overrides:
clear
in classAbstractList<TypedValue<?>>
-
remove
- Specified by:
remove
in interfaceCollection<TypedValue<?>>
- Specified by:
remove
in interfaceList<TypedValue<?>>
- Overrides:
remove
in classAbstractCollection<TypedValue<?>>
-
equals
- Specified by:
equals
in interfaceCollection<TypedValue<?>>
- Specified by:
equals
in interfaceList<TypedValue<?>>
- Overrides:
equals
in classAbstractList<TypedValue<?>>
-
hashCode
public int hashCode()Description copied from interface:StoreList
hashcode() implementations of Complex list objects do not necessarily adhere to the default Java List contract for hashcode.- Specified by:
hashCode
in interfaceCollection<TypedValue<?>>
- Specified by:
hashCode
in interfaceList<TypedValue<?>>
- Specified by:
hashCode
in interfaceStoreList
- Overrides:
hashCode
in classAbstractList<TypedValue<?>>
- Returns:
- hashcode.
-
toString
Description copied from interface:ComplexData
Generate 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:
toString
in interfaceComplexData
- Parameters:
skipWhitespace
- line breaks and indention, or not.- Returns:
- String version of this object.
-
toString
- Overrides:
toString
in classAbstractCollection<TypedValue<?>>
-