com.streambase.sb

## Class TupleMapView

- java.lang.Object
- - java.util.AbstractMap<String,Object>
  - - com.streambase.sb.TupleMapView

- All Implemented Interfaces:
    Map<String,Object>

      class TupleMapView
      extends AbstractMap<String,Object>

  A view onto a `Tuple` which uses the `Map` interface. This version does not support any remove operations on the map since we cannot remove a field from a Tuple (it has a fixed schema). Put is allowed. This class is only meant to be instantiated by the method `Tuple.toMapView()`.
  Since:
    7.0
  See Also:
    `Tuple.toMapView()`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.AbstractMap

      `AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,V>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TupleMapView(Tuple tuple)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `boolean` | `containsKey(Object fieldKey)` Searches the schema of the Tuple to see if it contains the given field
    `boolean` | `containsValue(Object value)` Searches this Tuple for the specified value.
    `Set<Map.Entry<String,Object>>` | `entrySet()` Returns a `Set` whose elements comprise all of the mappings that are to be found in this `Tuple`.
    `Object` | `get(Object fieldKey)` returns the value for the given field key.
    `Set<String>` | `keySet()` Returns all of the (top-level) field names in a read-only `Set`.
    `Object` | `put(String fieldKey, Object fieldValue)` add a mapping to the Tuple.
    `void` | `putAll(Map<? extends String,? extends Object> map)` Put all the the values in the given map into the Tuple.
    `Object` | `remove(Object fieldKey)`
    `int` | `size()` returns the number of fields in the Tuple's underlying schema
    `Collection<Object>` | `values()` return a collection of all of the values in the underlying tuple

    - ### Methods inherited from class java.util.AbstractMap

      `clone, equals, hashCode, isEmpty, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Map

      `compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll`

- - ### Constructor Detail

    - #### TupleMapView

          TupleMapView(Tuple tuple)

      Parameters:
        `tuple` -

  - ### Method Detail

    - #### containsKey

          public boolean containsKey(Object fieldKey)

      Searches the schema of the Tuple to see if it contains the given field
      Specified by:
        `containsKey` in interface `Map<String,Object>`
      Overrides:
        `containsKey` in class `AbstractMap<String,Object>`
      Parameters:
        `fieldKey` - the field name that we are looking for

    - #### containsValue

          public boolean containsValue(Object value)

      Searches this Tuple for the specified value. Each field will be compared (using the returned value from `Tuple#getField(Field)`) by `Object.equals(Object)` against the passed in value for containment in this Tuple.
      Specified by:
        `containsValue` in interface `Map<String,Object>`
      Overrides:
        `containsValue` in class `AbstractMap<String,Object>`
      Parameters:
        `value` - the object to search for
      Returns:
        true if `value` is a value in this Tuple, false otherwise
      Since:
        7.0

    - #### entrySet

          public Set<Map.Entry<String,Object>> entrySet()

      Returns a `Set` whose elements comprise all of the mappings that are to be found in this `Tuple`. Information on each of the mappings is encapsulated in a separate `Map.Entry` instance. As the `Set` is backed by this `Map`, users should be aware that changes in one will be immediately visible in the other.
      Specified by:
        `entrySet` in interface `Map<String,Object>`
      Specified by:
        `entrySet` in class `AbstractMap<String,Object>`
      Returns:
        a `Set` of the mappings
      Since:
        7.0

    - #### keySet

          public Set<String> keySet()

      Returns all of the (top-level) field names in a read-only `Set`.

      Note: this implementation does not return a Set backed by this Tuple, as specified by `Map.keySet()`. In particular, the Set returned is unmodifiable.

      Specified by:
        `keySet` in interface `Map<String,Object>`
      Overrides:
        `keySet` in class `AbstractMap<String,Object>`
      Returns:
        a Set of the keys (String
      Since:
        7.0

    - #### values

          public Collection<Object> values()

      return a collection of all of the values in the underlying tuple
      Specified by:
        `values` in interface `Map<String,Object>`
      Overrides:
        `values` in class `AbstractMap<String,Object>`

    - #### get

          public Object get(Object fieldKey)

      returns the value for the given field key. If the field is null will return null.
      Specified by:
        `get` in interface `Map<String,Object>`
      Overrides:
        `get` in class `AbstractMap<String,Object>`

    - #### put

          public Object put(String fieldKey,
                            Object fieldValue)

      add a mapping to the Tuple. The fieldKey must exist as a field in the Tuple's underlying schema for the mapping to succeed
      Specified by:
        `put` in interface `Map<String,Object>`
      Overrides:
        `put` in class `AbstractMap<String,Object>`
      Parameters:
        `fieldKey` - a valid field in the Tuple's underlying schema
        `fieldValue` - a valid value for the field's type
      Throws:
        `NullPointerException` - on null key
        `IllegalArgumentException` - if there is a problem mapping the given fieldValue to the fieldKey

    - #### putAll

          public void putAll(Map<? extends String,? extends Object> map)

      Put all the the values in the given map into the Tuple. Uses same rules as `TupleMapView.put(String, Object)`
      Specified by:
        `putAll` in interface `Map<String,Object>`
      Overrides:
        `putAll` in class `AbstractMap<String,Object>`

    - #### remove

          public Object remove(Object fieldKey)

      Specified by:
        `remove` in interface `Map<String,Object>`
      Overrides:
        `remove` in class `AbstractMap<String,Object>`
      Throws:
        `UnsupportedOperationException` - since the underlying schema is fixed

    - #### size

          public int size()

      returns the number of fields in the Tuple's underlying schema
      Specified by:
        `size` in interface `Map<String,Object>`
      Overrides:
        `size` in class `AbstractMap<String,Object>`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Map<String,Object>`
      Overrides:
        `clear` in class `AbstractMap<String,Object>`
      Throws:
        `UnsupportedOperationException` - since the underlying schema is fixed

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.