Package com.yahoo.document.datatypes
Class StructuredFieldValue
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.StructuredFieldValue
- All Implemented Interfaces:
Cloneable
,Comparable<FieldValue>
- Author:
- HÃ¥kon Humberset
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
clear()
protected abstract void
doSetFieldValue
(Field field, FieldValue value) abstract Field
Returns the named field object, or null if that field does not exist.abstract int
abstract FieldValue
getFieldValue
(Field field) Returns the value of the given field.getFieldValue
(String fieldName) Convenience method to return the value of a named field.protected boolean
Generated Document subclasses should override this and return true.iterateNested
(FieldPath fieldPath, int pos, FieldPathIteratorHandler handler) abstract Iterator<Map.Entry<Field,
FieldValue>> iterator()
abstract FieldValue
removeFieldValue
(Field field) Removes and returns a field value.removeFieldValue
(String fieldName) Convenience method to remove the value of a named field.setFieldValue
(Field field, FieldValue value) Sets the value of the given field.final FieldValue
setFieldValue
(Field field, Byte value) final FieldValue
setFieldValue
(Field field, Double value) final FieldValue
setFieldValue
(Field field, Integer value) final FieldValue
setFieldValue
(Field field, Long value) final FieldValue
setFieldValue
(Field field, String value) setFieldValue
(String fieldName, FieldValue value) Convenience method to set the value of a named field.final FieldValue
setFieldValue
(String field, Boolean value) final FieldValue
setFieldValue
(String field, Byte value) final FieldValue
setFieldValue
(String field, Double value) final FieldValue
setFieldValue
(String field, Integer value) final FieldValue
setFieldValue
(String field, Long value) final FieldValue
setFieldValue
(String field, String value) Methods inherited from class com.yahoo.document.datatypes.CompositeFieldValue
equals, hashCode, setDataType
Methods inherited from class com.yahoo.document.datatypes.FieldValue
assign, clone, compareTo, create, deserialize, deserialize, getRecursiveValue, getRecursiveValue, getWrappedValue, onDeserialize, onSerialize, printXml, serialize, serialize, toXml
Methods inherited from class com.yahoo.vespa.objects.Identifiable
create, createFromId, deserialize, deserializeOptional, deserializeWithId, equals, getClassId, getRawUtf8Bytes, getUtf8, onGetClassId, putUtf8, registerClass, registerClass, serialize, serializeOptional, serializeWithId, toString, visitMembers
Methods inherited from class com.yahoo.vespa.objects.Selectable
select, select, selectMembers
-
Field Details
-
classId
public static final int classId
-
-
Constructor Details
-
StructuredFieldValue
-
-
Method Details
-
getDataType
- Overrides:
getDataType
in classCompositeFieldValue
-
getField
Returns the named field object, or null if that field does not exist.- Parameters:
fieldName
- The name of the field to return.- Returns:
- The corresponding field, or null.
-
getFieldValue
Returns the value of the given field. If the field does not exist, this method returns null.- Parameters:
field
- The field whose value to return.- Returns:
- The value of the field, or null.
-
getFieldValue
Convenience method to return the value of a named field. This is the same as callinggetField(String)
, and using the returned value to callgetFieldValue(Field)
. If the named field does not exist, this method returns null.- Parameters:
fieldName
- the name of the field whose value to return.- Returns:
- the value of the field, or null if it is not declared in this, or has no value set
-
setFieldValue
Sets the value of the given field. The type of the value must match the type of this field, i.e.field.getDataType().getValueClass().isAssignableFrom(value.getClass())
must be true.- Parameters:
field
- the field whose value to setvalue
- the value to set- Returns:
- the previous value of the field, or null
- Throws:
IllegalArgumentException
- if the value is not compatible with the field
-
doSetFieldValue
-
setFieldValue
Convenience method to set the value of a named field. This is the same as callinggetField(String)
, and using the returned value to callsetFieldValue(Field, FieldValue)
. If the named field does not exist, this method returns null.- Parameters:
fieldName
- The name of the field whose value to set.value
- The value to set.- Returns:
- The previous value of the field, or null.
-
setFieldValue
-
setFieldValue
-
setFieldValue
-
setFieldValue
-
setFieldValue
-
setFieldValue
-
setFieldValue
-
setFieldValue
-
setFieldValue
-
setFieldValue
-
setFieldValue
-
removeFieldValue
Removes and returns a field value.- Parameters:
field
- The field whose value to remove.- Returns:
- The previous value of the field, or null.
-
removeFieldValue
Convenience method to remove the value of a named field. This is the same as callinggetField(String)
, and using the returned value to callremoveFieldValue(Field)
. If the named field does not exist, this method returns null.- Parameters:
fieldName
- The name of the field whose value to remove.- Returns:
- The previous value of the field, or null.
-
clear
public abstract void clear()- Specified by:
clear
in classFieldValue
-
getFieldCount
public abstract int getFieldCount() -
iterator
-
iterateNested
public FieldPathIteratorHandler.ModificationStatus iterateNested(FieldPath fieldPath, int pos, FieldPathIteratorHandler handler) -
isGenerated
protected boolean isGenerated()Generated Document subclasses should override this and return true. This is used instead of using class.getAnnotation(Generated.class), because that is so slow.- Returns:
- true if in a concrete subtype of Document
-