Class MapValue
- All Implemented Interfaces:
- Comparable<FieldValue>,- Iterable<Map.Entry<String,- FieldValue>> 
FieldValue objects which
 may be atomic types or embedded MapValue or ArrayValue instances,
 creating a structured row.
 MapValue is also used to represent key values used in get operations as well as nested maps or records within a row.
 Field names in a MapValue follow the same rules as Java Map,
 meaning that they are case-sensitive string values with no duplicates.
 On input MapValues of any structure can be created, but when put into a
 table they must conform to the schema of the target table or an exception
 will be thrown. Note that in the context of a RECORD field in a table
 schema field names are treated as case-insensitive. If a MapValue
 represents JSON, field names are case-sensitive.
 
NullValue instance using
 "put(fieldName, NullValue.getInstance())"
 When a MapValue is received on output the value will always conform to the schema of the table from which the value was received or the implied schema of a query projection.
- 
Nested Class SummaryNested classes/interfaces inherited from class oracle.nosql.driver.values.FieldValueFieldValue.Type
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddAll(Iterator<Map.Entry<String, FieldValue>> iter) Inserts all of the entries in the specified iterator into the map.addAll(Stream<Map.Entry<String, FieldValue>> stream) Inserts all of the entries in the specified stream into the map.intcompareTo(FieldValue other) booleanReturns true if the specified field exists in the mapentrySet()Returns aSetof entries based on the underlying map that holds the values.booleanReturns the field the specified name, or null if the field does not exist.byte[]Gets the named field as a binary valuebooleangetBoolean(String name) Gets the named field as a booleandoubleGets the named field as a doubleintGets the named field as an integerlongGets the named field as a longgetMap()Returns a liveMapof the MapValue state.Gets the named field as a BigDecimalGets the named field as a StringgetTimestamp(String name) Gets the named field as a long timestamp representing the milliseconds since January 1, 1970getType()Returns the type of the objectReturns the type of the field with the specified name, or null if the field does not exist.inthashCode()iterator()Returns an iterator over the entry set.Sets the named field as a BooleanValue.Sets the named field as a BinaryValue.Sets the named field as a DoubleValue.Sets the named field as an IntegerValue.Sets the named field as a LongValue.Sets the named field as a StringValue.put(String name, BigDecimal value) Sets the named field as a NumberValue.Sets the named field as a TimestampValue.put(String name, FieldValue value) Sets the named field.putFromJson(String name, String jsonString, JsonOptions options) Sets the named field based on the JSON string provided.Removes the named field if it exists.intsize()Returns the number of entries in the map.values()Returns aCollectionofFieldValueinstances contained in this map.Methods inherited from class oracle.nosql.driver.values.FieldValueasArray, asBinary, asBoolean, asDouble, asInteger, asJsonNull, asLong, asMap, asNull, asNumber, asString, asTimestamp, castAsDouble, createFromJson, createFromJson, createFromJson, getBinary, getBoolean, getDouble, getInt, getLong, getNumber, getSerializedSize, getString, getTimestamp, isAnyNull, isArray, isAtomic, isBinary, isBoolean, isDouble, isInteger, isJsonNull, isLong, isMap, isNull, isNumber, isNumeric, isString, isTimestamp, toJson, toJson, toStringMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
MapValuepublic MapValue()Creates an empty MapValue instance
- 
MapValuepublic MapValue(boolean keepInsertionOrder, int size) Creates an empty MapValue instance- Parameters:
- keepInsertionOrder- if true a map is created that maintains insertion order. This is the default for get and query results.
- size- the initial capacity of the map
 
- 
MapValuepublic MapValue(int size) Creates an empty MapValue instance using the specified initial capacity- Parameters:
- size- the initial capacity
 
 
- 
- 
Method Details- 
getTypeDescription copied from class:FieldValueReturns the type of the object- Specified by:
- getTypein class- FieldValue
- Returns:
- the type
 
- 
getMapReturns a liveMapof the MapValue state.- Returns:
- the map
 
- 
entrySetReturns aSetof entries based on the underlying map that holds the values.- Returns:
- the set
 
- 
iteratorReturns an iterator over the entry set.- Specified by:
- iteratorin interface- Iterable<Map.Entry<String,- FieldValue>> 
- Returns:
- the iterator
- Since:
- 5.4
 
- 
sizepublic int size()Returns the number of entries in the map.- Returns:
- the size
 
- 
valuesReturns aCollectionofFieldValueinstances contained in this map.- Returns:
- the values
 
- 
addAllInserts all of the entries in the specified iterator into the map.- Parameters:
- iter- the iterator
- Returns:
- this
 
- 
addAllInserts all of the entries in the specified stream into the map.- Parameters:
- stream- the stream
- Returns:
- this
 
- 
getTypeReturns the type of the field with the specified name, or null if the field does not exist.- Parameters:
- name- the name of the field
- Returns:
- the type of the field, or null if it does not exist.
 
- 
getReturns the field the specified name, or null if the field does not exist.- Parameters:
- name- the name of the field
- Returns:
- the field, or null if it does not exist.
 
- 
containsReturns true if the specified field exists in the map- Parameters:
- name- the name of the field
- Returns:
- true if the field exists, false if not
- Since:
- 5.4
 
- 
putSets the named field. Any existing entry is silently overwritten.- Parameters:
- name- the name of the field
- value- the value to set
- Returns:
- this
 
- 
putSets the named field as an IntegerValue. Any existing entry is silently overwritten.- Parameters:
- name- the name of the field
- value- the value to set
- Returns:
- this
 
- 
putSets the named field as a LongValue. Any existing entry is silently overwritten.- Parameters:
- name- the name of the field
- value- the value to set
- Returns:
- this
 
- 
putSets the named field as a DoubleValue. Any existing entry is silently overwritten.- Parameters:
- name- the name of the field
- value- the value to set
- Returns:
- this
 
- 
putSets the named field as a NumberValue. Any existing entry is silently overwritten.- Parameters:
- name- the name of the field
- value- the value to set
- Returns:
- this
 
- 
putSets the named field as a StringValue. Any existing entry is silently overwritten.- Parameters:
- name- the name of the field
- value- the value to set
- Returns:
- this
 
- 
putSets the named field as a BooleanValue. Any existing entry is silently overwritten.- Parameters:
- name- the name of the field
- value- the value to set
- Returns:
- this
 
- 
putSets the named field as a BinaryValue. Any existing entry is silently overwritten.- Parameters:
- name- the name of the field
- value- the value to set
- Returns:
- this
 
- 
putSets the named field as a TimestampValue. Any existing entry is silently overwritten.- Parameters:
- name- the name of the field
- value- the value to set
- Returns:
- this
 
- 
putFromJsonSets the named field based on the JSON string provided. Any existing entry is silently overridden. The type of the field created is inferred from the JSON.- Parameters:
- name- the name of the field
- jsonString- a JSON formatted String
- options- configurable options used to affect the JSON output format of some data types. May be null.
- Returns:
- this
- Throws:
- IllegalArgumentException- if the string is not valid JSON
 
- 
removeRemoves the named field if it exists.- Parameters:
- name- the name of the field
- Returns:
- the previous value if it existed, otherwise null
 
- 
getIntGets the named field as an integer- Parameters:
- name- the name of the field
- Returns:
- the integer value
- Throws:
- IllegalArgumentException- if the field does not exist.
- ClassCastException- if the field cannot be cast to the required type
 
- 
getLongGets the named field as a long- Parameters:
- name- the name of the field
- Returns:
- the long value
- Throws:
- IllegalArgumentException- if the field does not exist.
- ClassCastException- if the field cannot be cast to the required type
 
- 
getDoubleGets the named field as a double- Parameters:
- name- the name of the field
- Returns:
- the double value
- Throws:
- IllegalArgumentException- if the field does not exist.
- ClassCastException- if the field cannot be cast to the required type
 
- 
getNumberGets the named field as a BigDecimal- Parameters:
- name- the name of the field
- Returns:
- the BigDecimal value
- Throws:
- IllegalArgumentException- if the field does not exist.
- ClassCastException- if the field cannot be cast to the required type
 
- 
getStringGets the named field as a String- Parameters:
- name- the name of the field
- Returns:
- the String value
- Throws:
- IllegalArgumentException- if the field does not exist.
- ClassCastException- if the field cannot be cast to the required type
 
- 
getBooleanGets the named field as a boolean- Parameters:
- name- the name of the field
- Returns:
- the boolean value
- Throws:
- IllegalArgumentException- if the field does not exist.
- ClassCastException- if the field cannot be cast to the required type
 
- 
getBinaryGets the named field as a binary value- Parameters:
- name- the name of the field
- Returns:
- the binary value
- Throws:
- IllegalArgumentException- if the field does not exist.
- ClassCastException- if the field cannot be cast to the required type
 
- 
getTimestampGets the named field as a long timestamp representing the milliseconds since January 1, 1970- Parameters:
- name- the name of the field
- Returns:
- the timestamp value
- Throws:
- IllegalArgumentException- if the field does not exist.
- ClassCastException- if the field cannot be cast to the required type
 
- 
compareTo- Specified by:
- compareToin interface- Comparable<FieldValue>
 
- 
equals
- 
hashCodepublic int hashCode()
 
-