Package oracle.kv.table
Interface MapValue
- All Superinterfaces:
Comparable<FieldValue>
,FieldValue
MapValue extends
FieldValue
to define a container object that holds
a map of FieldValue objects all of the same type. The getters and setters
use the same semantics as Java Map. Map keys are case-sensitive.- Since:
- 3.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a deep copy of this object.Returns the FieldValue with the specified name if it appears in the map.Returns the MapDef that defines the content of this map.Returns an unmodifiable view of the MapValue state.Set the named field.Set the named field.Set the named field.Set the named field.Set the named field.Set the named field.Set the named field.Set the named field.put
(String fieldName, FieldValue value) Set the named field.Puts an Array into the map.Set the named field.Set the named field.Puts arbitrary JSON into this map in the specified field.Puts arbitrary JSON into this map in the specified field.putJsonNull
(String fieldName) Puts a JSON null value in the named field, silently overwriting existing values.Puts a Map into the map.Set the named field.Set the named field.Set the named field.Set the named field.putNumber
(String fieldName, BigDecimal value) Set the named field.Puts a Record into the map.Remove the named field if it exists.int
size()
Returns the size of the map.toString()
Returns a String representation of the value.Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface oracle.kv.table.FieldValue
asArray, asBinary, asBoolean, asDouble, asEnum, asFixedBinary, asFloat, asIndexKey, asInteger, asLong, asMap, asNumber, asPrimaryKey, asRecord, asRow, asString, asTimestamp, getType, isArray, isAtomic, isBinary, isBoolean, isComplex, isDouble, isEMPTY, isEnum, isFixedBinary, isFloat, isIndexKey, isInteger, isJsonNull, isLong, isMap, isNull, isNumber, isNumeric, isPrimaryKey, isRecord, isRow, isString, isTimestamp, toJsonString
-
Field Details
-
ANONYMOUS
A constant used as a key for a map value when the value is used as part of an IndexKey when there is an index on the value of a map's element or a nested value within the element if the element is a record.- See Also:
-
-
Method Details
-
clone
MapValue clone()Returns a deep copy of this object.- Specified by:
clone
in interfaceFieldValue
- Returns:
- a deep copy of this object
-
toString
String toString()Returns a String representation of the value. The value is returned is a JSON string, and is the same as that returned byFieldValue.toJsonString(boolean)
. -
getDefinition
MapDef getDefinition()Returns the MapDef that defines the content of this map.- Specified by:
getDefinition
in interfaceFieldValue
- Returns:
- the MapDef
-
size
int size()Returns the size of the map.- Returns:
- the size
-
getFields
Map<String,FieldValue> getFields()Returns an unmodifiable view of the MapValue state. The type of all fields is the same and is defined by theMapDef
returned bygetDefinition()
.- Returns:
- the map
- Since:
- 3.0.6
-
remove
Remove the named field if it exists.- Parameters:
fieldName
- the name of the field to remove- Returns:
- the FieldValue if it existed, otherwise null
-
get
Returns the FieldValue with the specified name if it appears in the map.- Parameters:
fieldName
- the name of the desired field.- Returns:
- the value for the field or null if the name does not exist in the map.
-
putJsonNull
Puts a JSON null value in the named field, silently overwriting existing values. This operation is only valid for maps of type JSON.- Parameters:
fieldName
- name of the desired field- Returns:
- this
- Throws:
IllegalArgumentException
- if this map is not of type JSON- Since:
- 4.3
-
put
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type
-
put
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type
-
put
Set the named field. Any existing entry is silently overwritten. This method is used to put a string into a map of type String. The String value is not parsed or interpreted. The methodsputJson(java.lang.String, java.lang.String)
andputEnum(java.lang.String, java.lang.String)
exist to put String values of those types.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type
-
put
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type
-
putNumber
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type- Since:
- 4.4
-
putNumber
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type- Since:
- 4.4
-
putNumber
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type- Since:
- 4.4
-
putNumber
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type- Since:
- 4.4
-
putNumber
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type- Since:
- 4.4
-
put
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type
-
put
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type
-
put
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type
-
putFixed
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type
-
putEnum
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type
-
put
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type- Since:
- 4.3
-
put
Set the named field. Any existing entry is silently overwritten.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the definition of the map type does not match the input type
-
putRecord
Puts a Record into the map. Existing values are silently overwritten.- Parameters:
fieldName
- the field to use for the map key- Returns:
- an uninitialized RecordValue that matches the type definition for the map
- Throws:
IllegalArgumentException
- if the definition of the map type is not a RecordDef
-
putMap
Puts a Map into the map. Existing values are silently overwritten.- Parameters:
fieldName
- the field to use for the map key- Returns:
- an uninitialized MapValue that matches the type definition for the map
- Throws:
IllegalArgumentException
- if the definition of the map type is not a MapDef
-
putArray
Puts an Array into the map. Existing values are silently overwritten.- Parameters:
fieldName
- the field to use for the map key- Returns:
- an uninitialized ArrayValue that matches the type definition for the map
- Throws:
IllegalArgumentException
- if the definition of the map type is not an ArrayDef
-
putJson
Puts arbitrary JSON into this map in the specified field. Existing values are silently overwritten.- Parameters:
fieldName
- the field to use for the map keyjsonInput
- a JSON string- Returns:
- this
- Throws:
IllegalArgumentException
- if this map is not of type JSON or the JSON input is invalid.- Since:
- 4.2
-
putJson
Puts arbitrary JSON into this map in the specified field. Existing values are silently overwritten.- Parameters:
fieldName
- the field to use for the map keyjsonReader
- a Reader- Returns:
- this
- Throws:
IllegalArgumentException
- if this map is not of type JSON or the JSON input is invalid.- Since:
- 4.2
-