Class StoreMapImpl
java.lang.Object
com.terracottatech.store.definition.StoreMapImpl
- All Implemented Interfaces:
ComplexData
,StoreMap
,Map<String,
TypedValue<?>>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.terracottatech.store.ComplexData
ComplexData.DotSpecParseException
-
Constructor Summary
ConstructorsConstructorDescriptionStoreMapImpl
(com.terracottatech.tcson.MutableSonMap mutable) StoreMapImpl
(com.terracottatech.tcson.MutableSonMap map, boolean mutable) StoreMapImpl
(com.terracottatech.tcson.ReadableSonMap rmap) StoreMapImpl
(Map<String, TypedValue<?>> incoming) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) Set<Map.Entry<String,
TypedValue<?>>> entrySet()
boolean
Do a filtering find operation across this object based on the Dot Notation given.TypedValue<?>
int
hashCode()
boolean
isEmpty()
Is this object empty?boolean
Is this a mutable representation?keySet()
com.terracottatech.tcson.SonMap<? extends com.terracottatech.tcson.SonMapValue>
liveMap()
Make deep copy of this map, ensuring it is mutable.TypedValue<?>
put
(String key, TypedValue<?> value) void
putAll
(Map<? extends String, ? extends TypedValue<?>> m) TypedValue<?>
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.Collection<TypedValue<?>>
values()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.terracottatech.store.ComplexData
notEmpty
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
StoreMapImpl
-
StoreMapImpl
public StoreMapImpl(com.terracottatech.tcson.ReadableSonMap rmap) -
StoreMapImpl
public StoreMapImpl(com.terracottatech.tcson.MutableSonMap mutable) -
StoreMapImpl
public StoreMapImpl(com.terracottatech.tcson.MutableSonMap map, boolean mutable) -
StoreMapImpl
public StoreMapImpl()
-
-
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
-
mutableCopy
Description copied from interface:StoreMap
Make deep copy of this map, ensuring it is mutable.- Specified by:
mutableCopy
in interfaceComplexData
- Specified by:
mutableCopy
in interfaceStoreMap
- Returns:
- mutable copy of this map
-
isMutable
public boolean isMutable()Description copied from interface:ComplexData
Is this a mutable representation?- Specified by:
isMutable
in interfaceComplexData
- Returns:
true
if mutable
-
liveMap
public com.terracottatech.tcson.SonMap<? extends com.terracottatech.tcson.SonMapValue> liveMap() -
size
public int size()Description copied from interface:ComplexData
Size (number of elements) in this object.- Specified by:
size
in interfaceComplexData
- Specified by:
size
in interfaceMap<String,
TypedValue<?>> - Returns:
- number of elements.
-
isEmpty
public boolean isEmpty()Description copied from interface:ComplexData
Is this object empty?- Specified by:
isEmpty
in interfaceComplexData
- Specified by:
isEmpty
in interfaceMap<String,
TypedValue<?>> - Returns:
- true if empty.
-
containsKey
- Specified by:
containsKey
in interfaceMap<String,
TypedValue<?>>
-
containsValue
- Specified by:
containsValue
in interfaceMap<String,
TypedValue<?>>
-
get
- Specified by:
get
in interfaceMap<String,
TypedValue<?>>
-
put
- Specified by:
put
in interfaceMap<String,
TypedValue<?>>
-
remove
- Specified by:
remove
in interfaceMap<String,
TypedValue<?>>
-
putAll
- Specified by:
putAll
in interfaceMap<String,
TypedValue<?>>
-
clear
public void clear()- Specified by:
clear
in interfaceMap<String,
TypedValue<?>>
-
keySet
- Specified by:
keySet
in interfaceMap<String,
TypedValue<?>>
-
values
- Specified by:
values
in interfaceMap<String,
TypedValue<?>>
-
entrySet
- Specified by:
entrySet
in interfaceMap<String,
TypedValue<?>>
-
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
-
equals
-
hashCode
public int hashCode()
-