Class StructuredFieldValue

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<FieldValue>
    Direct Known Subclasses:
    Document, Struct

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

      • classId

        public static final int classId
    • Constructor Detail

    • Method Detail

      • getField

        public abstract Field getField​(java.lang.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​(java.lang.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.
      • 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:
        java.lang.IllegalArgumentException - If the value is not compatible with the field.
      • doSetFieldValue

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

        public FieldValue setFieldValue​(java.lang.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,
                                              java.lang.String value)
      • setFieldValue

        public final FieldValue setFieldValue​(Field field,
                                              java.lang.Double value)
      • setFieldValue

        public final FieldValue setFieldValue​(Field field,
                                              java.lang.Integer value)
      • setFieldValue

        public final FieldValue setFieldValue​(Field field,
                                              java.lang.Long value)
      • setFieldValue

        public final FieldValue setFieldValue​(Field field,
                                              java.lang.Byte value)
      • setFieldValue

        public final FieldValue setFieldValue​(java.lang.String field,
                                              java.lang.String value)
      • setFieldValue

        public final FieldValue setFieldValue​(java.lang.String field,
                                              java.lang.Double value)
      • setFieldValue

        public final FieldValue setFieldValue​(java.lang.String field,
                                              java.lang.Integer value)
      • setFieldValue

        public final FieldValue setFieldValue​(java.lang.String field,
                                              java.lang.Long value)
      • setFieldValue

        public final FieldValue setFieldValue​(java.lang.String field,
                                              java.lang.Byte 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​(java.lang.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 java.util.Iterator<java.util.Map.Entry<Field,​FieldValue>> iterator()
      • 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