Class StructuredFieldValue

java.lang.Object
com.yahoo.vespa.objects.Selectable
com.yahoo.vespa.objects.Identifiable
All Implemented Interfaces:
Cloneable, Comparable<FieldValue>
Direct Known Subclasses:
Document, Struct

public abstract class StructuredFieldValue extends CompositeFieldValue
Author:
HÃ¥kon Humberset
  • Field Details

    • classId

      public static final int classId
  • Constructor Details

  • Method Details

    • getDataType

      public StructuredDataType getDataType()
      Overrides:
      getDataType in class CompositeFieldValue
    • getField

      public abstract Field getField(String fieldName)
      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

      public abstract FieldValue getFieldValue(Field field)
      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

      public FieldValue getFieldValue(String fieldName)
      Convenience method to return the value of a named field. This is the same as calling getField(String), and using the returned value to call getFieldValue(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

      public FieldValue setFieldValue(Field field, FieldValue value)
      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 set
      value - 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

      protected abstract void doSetFieldValue(Field field, FieldValue value)
    • setFieldValue

      public FieldValue setFieldValue(String fieldName, FieldValue value)
      Convenience method to set the value of a named field. This is the same as calling getField(String), and using the returned value to call setFieldValue(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

      public final FieldValue setFieldValue(Field field, String value)
    • setFieldValue

      public final FieldValue setFieldValue(Field field, Double value)
    • setFieldValue

      public final FieldValue setFieldValue(Field field, Integer value)
    • setFieldValue

      public final FieldValue setFieldValue(Field field, Long value)
    • setFieldValue

      public final FieldValue setFieldValue(Field field, Byte value)
    • setFieldValue

      public final FieldValue setFieldValue(String field, String value)
    • setFieldValue

      public final FieldValue setFieldValue(String field, Double value)
    • setFieldValue

      public final FieldValue setFieldValue(String field, Integer value)
    • setFieldValue

      public final FieldValue setFieldValue(String field, Long value)
    • setFieldValue

      public final FieldValue setFieldValue(String field, Byte value)
    • setFieldValue

      public final FieldValue setFieldValue(String field, Boolean value)
    • removeFieldValue

      public abstract FieldValue removeFieldValue(Field field)
      Removes and returns a field value.
      Parameters:
      field - The field whose value to remove.
      Returns:
      The previous value of the field, or null.
    • removeFieldValue

      public FieldValue removeFieldValue(String fieldName)
      Convenience method to remove the value of a named field. This is the same as calling getField(String), and using the returned value to call removeFieldValue(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 class FieldValue
    • getFieldCount

      public abstract int getFieldCount()
    • iterator

      public abstract Iterator<Map.Entry<Field,FieldValue>> 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