class TupleMapView extends AbstractMap<String,Object>
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()
.Tuple.toMapView()
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
TupleMapView(Tuple tuple) |
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
|
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
TupleMapView(Tuple tuple)
tuple
- public boolean containsKey(Object fieldKey)
containsKey
in interface Map<String,Object>
containsKey
in class AbstractMap<String,Object>
fieldKey
- the field name that we are looking forpublic boolean containsValue(Object value)
Tuple#getField(Field)
)
by Object.equals(Object)
against the passed in value for
containment in this Tuple.containsValue
in interface Map<String,Object>
containsValue
in class AbstractMap<String,Object>
value
- the object to search forvalue
is a value in this Tuple, false
otherwisepublic Set<Map.Entry<String,Object>> entrySet()
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.public Set<String> keySet()
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.
public Collection<Object> values()
public Object get(Object fieldKey)
public Object put(String fieldKey, Object fieldValue)
put
in interface Map<String,Object>
put
in class AbstractMap<String,Object>
fieldKey
- a valid field in the Tuple's underlying schemafieldValue
- a valid value for the field's typeNullPointerException
- on null keyIllegalArgumentException
- if there is a problem mapping the given fieldValue to the fieldKeypublic void putAll(Map<? extends String,? extends Object> map)
TupleMapView.put(String, Object)
public Object remove(Object fieldKey)
remove
in interface Map<String,Object>
remove
in class AbstractMap<String,Object>
UnsupportedOperationException
- since the underlying schema is fixedpublic int size()
public void clear()
clear
in interface Map<String,Object>
clear
in class AbstractMap<String,Object>
UnsupportedOperationException
- since the underlying schema is fixedCopyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.