Package com.yahoo.document.datatypes
Class MapFieldValue<K extends FieldValue,V extends FieldValue>
- java.lang.Object
-
- com.yahoo.vespa.objects.Selectable
-
- com.yahoo.vespa.objects.Identifiable
-
- com.yahoo.document.datatypes.FieldValue
-
- com.yahoo.document.datatypes.CompositeFieldValue
-
- com.yahoo.document.datatypes.MapFieldValue<K,V>
-
- All Implemented Interfaces:
Cloneable
,Comparable<FieldValue>
,Map<K,V>
public class MapFieldValue<K extends FieldValue,V extends FieldValue> extends CompositeFieldValue implements Map<K,V>
Vespa map. Backed by and and parametrized by FieldValue- Author:
- vegardh
-
-
Field Summary
-
Fields inherited from class com.yahoo.document.datatypes.FieldValue
classId
-
-
Constructor Summary
Constructors Constructor Description MapFieldValue(MapDataType type)
MapFieldValue(MapDataType type, int initialCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(Object o)
Assign this non-fieldvalue value to this field value.void
clear()
MapFieldValue
clone()
int
compareTo(FieldValue fieldValue)
boolean
contains(Object o)
boolean
containsKey(Object key)
boolean
containsValue(Object value)
void
deserialize(Field field, FieldReader reader)
Read a field value from the specified readerSet<Map.Entry<K,V>>
entrySet()
boolean
equals(Object o)
Checks if another object is equal to this set.V
get(Object key)
MapDataType
getDataType()
Object
getWrappedValue()
Used to retrieve wrapped type for simple types, such that you can use get methods to retrieve ints and floats directly instead of Int/Float field values.boolean
isEmpty()
Set<K>
keySet()
void
printXml(XmlStream xml)
V
put(K key, V value)
void
putAll(Map<? extends K,? extends V> m)
V
remove(Object key)
void
serialize(Field field, FieldWriter writer)
Write out field value to the specified writerint
size()
Collection<V>
values()
-
Methods inherited from class com.yahoo.document.datatypes.CompositeFieldValue
hashCode, setDataType
-
Methods inherited from class com.yahoo.document.datatypes.FieldValue
create, deserialize, getRecursiveValue, getRecursiveValue, onDeserialize, onSerialize, serialize, toXml
-
Methods inherited from class com.yahoo.vespa.objects.Identifiable
create, createFromId, deserialize, deserializeOptional, deserializeWithId, equals, getClassId, getRawUtf8Bytes, getUtf8, onGetClassId, putUtf8, registerClass, serialize, serializeOptional, serializeWithId, toString, visitMembers
-
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, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
MapFieldValue
public MapFieldValue(MapDataType type)
-
MapFieldValue
public MapFieldValue(MapDataType type, int initialCapacity)
-
-
Method Detail
-
getDataType
public MapDataType getDataType()
- Overrides:
getDataType
in classCompositeFieldValue
-
assign
public void assign(Object o)
Description copied from class:FieldValue
Assign this non-fieldvalue value to this field value. This is used to be able to assign ints to Integer field values and List to Array field values and such.Override to accept the specific types that should be legal.
- Specified by:
assign
in classFieldValue
-
clone
public MapFieldValue clone()
- Overrides:
clone
in classFieldValue
-
equals
public boolean equals(Object o)
Checks if another object is equal to this set.- Specified by:
equals
in interfaceMap<K extends FieldValue,V extends FieldValue>
- Overrides:
equals
in classCompositeFieldValue
- Parameters:
o
- the object to check for equality with- Returns:
- true if o is an instance of WeightedSet and the two encapsulated Maps are equal, false otherwise
-
clear
public void clear()
- Specified by:
clear
in interfaceMap<K extends FieldValue,V extends FieldValue>
- Specified by:
clear
in classFieldValue
-
deserialize
public void deserialize(Field field, FieldReader reader)
Description copied from class:FieldValue
Read a field value from the specified reader- Specified by:
deserialize
in classFieldValue
-
printXml
public void printXml(XmlStream xml)
- Specified by:
printXml
in classFieldValue
-
serialize
public void serialize(Field field, FieldWriter writer)
Description copied from class:FieldValue
Write out field value to the specified writer- Specified by:
serialize
in classFieldValue
-
getWrappedValue
public Object getWrappedValue()
Description copied from class:FieldValue
Used to retrieve wrapped type for simple types, such that you can use get methods to retrieve ints and floats directly instead of Int/Float field values. Complex types that can't be specified by simple java types just return themself.- Overrides:
getWrappedValue
in classFieldValue
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
entrySet
public Set<Map.Entry<K,V>> entrySet()
- Specified by:
entrySet
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
get
public V get(Object key)
- Specified by:
get
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
keySet
public Set<K> keySet()
- Specified by:
keySet
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
put
public V put(K key, V value)
- Specified by:
put
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
putAll
public void putAll(Map<? extends K,? extends V> m)
- Specified by:
putAll
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
remove
public V remove(Object key)
- Specified by:
remove
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
values
public Collection<V> values()
- Specified by:
values
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
contains
public boolean contains(Object o)
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
size
public int size()
- Specified by:
size
in interfaceMap<K extends FieldValue,V extends FieldValue>
-
compareTo
public int compareTo(FieldValue fieldValue)
- Specified by:
compareTo
in interfaceComparable<K extends FieldValue>
- Overrides:
compareTo
in classFieldValue
-
-