Package com.yahoo.document.datatypes
Class Array<T 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.CollectionFieldValue<T>
-
- com.yahoo.document.datatypes.Array<T>
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Comparable<FieldValue>
,java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.List<T>
public final class Array<T extends FieldValue> extends CollectionFieldValue<T> implements java.util.List<T>
FieldValue which encapsulates a Array value- Author:
- Einar M R Rosenvinge
-
-
Field Summary
-
Fields inherited from class com.yahoo.document.datatypes.FieldValue
classId
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, T o)
boolean
add(T o)
boolean
addAll(int index, java.util.Collection<? extends T> c)
boolean
addAll(java.util.Collection<? extends T> c)
void
assign(java.lang.Object o)
Assign this non-fieldvalue value to this field value.void
clear()
Array<T>
clone()
int
compareTo(FieldValue fieldValue)
boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
void
deserialize(Field field, FieldReader reader)
Read a field value from the specified readerboolean
equals(java.lang.Object o)
java.util.Iterator<T>
fieldValueIterator()
T
get(int index)
ArrayDataType
getDataType()
FieldValue
getFieldValue(int index)
java.util.List<T>
getValues()
java.lang.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.int
hashCode()
int
indexOf(java.lang.Object o)
boolean
isEmpty()
java.util.Iterator<T>
iterator()
int
lastIndexOf(java.lang.Object o)
java.util.ListIterator<T>
listIterator()
java.util.ListIterator<T>
listIterator(int index)
void
printXml(XmlStream xml)
T
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
removeValue(FieldValue o)
boolean
retainAll(java.util.Collection<?> c)
void
serialize(Field field, FieldWriter writer)
Write out field value to the specified writerT
set(int index, T o)
int
size()
java.util.List<T>
subList(int fromIndex, int toIndex)
java.lang.Object[]
toArray()
<T> T[]
toArray(T[] a)
java.lang.String
toString()
-
Methods inherited from class com.yahoo.document.datatypes.CollectionFieldValue
createFieldValue, isEmpty, removeValue, verifyElementCompatibility
-
Methods inherited from class com.yahoo.document.datatypes.CompositeFieldValue
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, getUtf8, onGetClassId, putUtf8, registerClass, serialize, serializeOptional, serializeWithId, visitMembers
-
-
-
-
Method Detail
-
getDataType
public ArrayDataType getDataType()
- Overrides:
getDataType
in classCollectionFieldValue<T extends FieldValue>
-
fieldValueIterator
public java.util.Iterator<T> fieldValueIterator()
- Specified by:
fieldValueIterator
in classCollectionFieldValue<T extends FieldValue>
-
clone
public Array<T> clone()
- Overrides:
clone
in classFieldValue
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
clear
in interfacejava.util.List<T extends FieldValue>
- Specified by:
clear
in classFieldValue
-
assign
public void assign(java.lang.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
-
getWrappedValue
public java.lang.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
-
getValues
public java.util.List<T> getValues()
-
getFieldValue
public FieldValue getFieldValue(int index)
-
printXml
public void printXml(XmlStream xml)
- Specified by:
printXml
in classFieldValue
-
toString
public java.lang.String toString()
- Overrides:
toString
in classcom.yahoo.vespa.objects.Identifiable
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
hashCode
in interfacejava.util.List<T extends FieldValue>
- Overrides:
hashCode
in classCompositeFieldValue
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
equals
in interfacejava.util.List<T extends FieldValue>
- Overrides:
equals
in classCompositeFieldValue
-
add
public void add(int index, T o)
- Specified by:
add
in interfacejava.util.List<T extends FieldValue>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
remove
in interfacejava.util.List<T extends FieldValue>
-
add
public boolean add(T o)
- Specified by:
add
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
add
in interfacejava.util.List<T extends FieldValue>
- Specified by:
add
in classCollectionFieldValue<T extends FieldValue>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
contains
in interfacejava.util.List<T extends FieldValue>
- Specified by:
contains
in classCollectionFieldValue<T extends FieldValue>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
isEmpty
in interfacejava.util.List<T extends FieldValue>
- Specified by:
isEmpty
in classCollectionFieldValue<T extends FieldValue>
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
iterator
in interfacejava.lang.Iterable<T extends FieldValue>
- Specified by:
iterator
in interfacejava.util.List<T extends FieldValue>
- Specified by:
iterator
in classCollectionFieldValue<T extends FieldValue>
-
removeValue
public boolean removeValue(FieldValue o)
- Specified by:
removeValue
in classCollectionFieldValue<T extends FieldValue>
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
size
in interfacejava.util.List<T extends FieldValue>
- Specified by:
size
in classCollectionFieldValue<T extends FieldValue>
-
addAll
public boolean addAll(java.util.Collection<? extends T> c)
- Specified by:
addAll
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
addAll
in interfacejava.util.List<T extends FieldValue>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
containsAll
in interfacejava.util.List<T extends FieldValue>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
toArray
in interfacejava.util.List<T extends FieldValue>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
toArray
in interfacejava.util.List<T extends FieldValue>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends T> c)
- Specified by:
addAll
in interfacejava.util.List<T extends FieldValue>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
retainAll
in interfacejava.util.List<T extends FieldValue>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<T extends FieldValue>
- Specified by:
removeAll
in interfacejava.util.List<T extends FieldValue>
-
get
public T get(int index)
- Specified by:
get
in interfacejava.util.List<T extends FieldValue>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOf
in interfacejava.util.List<T extends FieldValue>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOf
in interfacejava.util.List<T extends FieldValue>
-
listIterator
public java.util.ListIterator<T> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<T extends FieldValue>
-
listIterator
public java.util.ListIterator<T> listIterator(int index)
- Specified by:
listIterator
in interfacejava.util.List<T extends FieldValue>
-
remove
public T remove(int index)
- Specified by:
remove
in interfacejava.util.List<T extends FieldValue>
-
set
public T set(int index, T o)
- Specified by:
set
in interfacejava.util.List<T extends FieldValue>
-
subList
public java.util.List<T> subList(int fromIndex, int toIndex)
- Specified by:
subList
in interfacejava.util.List<T extends FieldValue>
-
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
-
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
-
compareTo
public int compareTo(FieldValue fieldValue)
- Specified by:
compareTo
in interfacejava.lang.Comparable<T extends FieldValue>
- Overrides:
compareTo
in classFieldValue
-
-