Package oracle.kv.table

# Interface MapValue

All Superinterfaces:
  `Comparable<FieldValue>`, `FieldValue`

public interface MapValue extends 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
  Modifier and Type
  Field
  Description
  `static final String`
  `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.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `MapValue`
  `clone()`
  Returns a deep copy of this object.
  `FieldValue`
  `get(String fieldName)`
  Returns the FieldValue with the specified name if it appears in the map.
  `MapDef`
  `getDefinition()`
  Returns the MapDef that defines the content of this map.
  `Map<String,FieldValue>`
  `getFields()`
  Returns an unmodifiable view of the MapValue state.
  `MapValue`
  `put(String fieldName, boolean value)`
  Set the named field.
  `MapValue`
  `put(String fieldName, byte[] value)`
  Set the named field.
  `MapValue`
  `put(String fieldName, double value)`
  Set the named field.
  `MapValue`
  `put(String fieldName, float value)`
  Set the named field.
  `MapValue`
  `put(String fieldName, int value)`
  Set the named field.
  `MapValue`
  `put(String fieldName, long value)`
  Set the named field.
  `MapValue`
  `put(String fieldName, String value)`
  Set the named field.
  `MapValue`
  `put(String fieldName, Timestamp value)`
  Set the named field.
  `MapValue`
  `put(String fieldName, FieldValue value)`
  Set the named field.
  `ArrayValue`
  `putArray(String fieldName)`
  Puts an Array into the map.
  `MapValue`
  `putEnum(String fieldName, String value)`
  Set the named field.
  `MapValue`
  `putFixed(String fieldName, byte[] value)`
  Set the named field.
  `MapValue`
  `putJson(String fieldName, Reader jsonReader)`
  Puts arbitrary JSON into this map in the specified field.
  `MapValue`
  `putJson(String fieldName, String jsonInput)`
  Puts arbitrary JSON into this map in the specified field.
  `MapValue`
  `putJsonNull(String fieldName)`
  Puts a JSON null value in the named field, silently overwriting existing values.
  `MapValue`
  `putMap(String fieldName)`
  Puts a Map into the map.
  `MapValue`
  `putNumber(String fieldName, double value)`
  Set the named field.
  `MapValue`
  `putNumber(String fieldName, float value)`
  Set the named field.
  `MapValue`
  `putNumber(String fieldName, int value)`
  Set the named field.
  `MapValue`
  `putNumber(String fieldName, long value)`
  Set the named field.
  `MapValue`
  `putNumber(String fieldName, BigDecimal value)`
  Set the named field.
  `RecordValue`
  `putRecord(String fieldName)`
  Puts a Record into the map.
  `FieldValue`
  `remove(String fieldName)`
  Remove the named field if it exists.
  `int`
  `size()`
  Returns the size of the map.
  `String`
  `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

    static final String 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:
      - Constant Field Values

- ## Method Details

  - ### clone

    MapValue clone()
    Returns a deep copy of this object.
    Specified by:
      `clone` in interface `FieldValue`
    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 by `FieldValue.toJsonString(boolean)`.
    Overrides:
      `toString` in class `Object`
    Returns:
      a String representation of the value

  - ### getDefinition

    MapDef getDefinition()
    Returns the MapDef that defines the content of this map.
    Specified by:
      `getDefinition` in interface `FieldValue`
    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 the `MapDef` returned by `getDefinition()`.
    Returns:
      the map
    Since:
      3.0.6

  - ### remove

    FieldValue remove(String fieldName)
    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

    FieldValue get(String fieldName)
    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

    MapValue putJsonNull(String fieldName)
    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

    MapValue put(String fieldName, int value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - the value to set
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the definition of the map type does not match the input type

  - ### put

    MapValue put(String fieldName, long value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - the value to set
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the definition of the map type does not match the input type

  - ### put

    MapValue put(String fieldName, String value)
    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 methods `putJson(java.lang.String, java.lang.String)` and `putEnum(java.lang.String, java.lang.String)` exist to put String values of those types.
    Parameters:
      `fieldName` - name of the desired field
      `value` - the value to set
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the definition of the map type does not match the input type

  - ### put

    MapValue put(String fieldName, double value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - the value to set
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the definition of the map type does not match the input type

  - ### putNumber

    MapValue putNumber(String fieldName, int value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - 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

    MapValue putNumber(String fieldName, long value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - 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

    MapValue putNumber(String fieldName, float value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - 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

    MapValue putNumber(String fieldName, double value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - 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

    MapValue putNumber(String fieldName, BigDecimal value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - 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

    MapValue put(String fieldName, float value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - the value to set
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the definition of the map type does not match the input type

  - ### put

    MapValue put(String fieldName, boolean value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - the value to set
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the definition of the map type does not match the input type

  - ### put

    MapValue put(String fieldName, byte[] value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - the value to set
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the definition of the map type does not match the input type

  - ### putFixed

    MapValue putFixed(String fieldName, byte[] value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - the value to set
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the definition of the map type does not match the input type

  - ### putEnum

    MapValue putEnum(String fieldName, String value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - the value to set
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the definition of the map type does not match the input type

  - ### put

    MapValue put(String fieldName, Timestamp value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - 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

    MapValue put(String fieldName, FieldValue value)
    Set the named field. Any existing entry is silently overwritten.
    Parameters:
      `fieldName` - name of the desired field
      `value` - the value to set
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if the definition of the map type does not match the input type

  - ### putRecord

    RecordValue putRecord(String fieldName)
    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

    MapValue putMap(String fieldName)
    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

    ArrayValue putArray(String fieldName)
    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

    MapValue putJson(String fieldName, String jsonInput)
    Puts arbitrary JSON into this map in the specified field. Existing values are silently overwritten.
    Parameters:
      `fieldName` - the field to use for the map key
      `jsonInput` - 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

    MapValue putJson(String fieldName, Reader jsonReader)
    Puts arbitrary JSON into this map in the specified field. Existing values are silently overwritten.
    Parameters:
      `fieldName` - the field to use for the map key
      `jsonReader` - a Reader
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if this map is not of type JSON or the JSON input is invalid.
    Since:
      4.2