Interface PropertyValue

All Superinterfaces:
Comparable<PropertyValue>

public interface PropertyValue extends Comparable<PropertyValue>
Immutable property value. A value is either an atom or an array of atoms.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    The number of values of this object.
    Type<?>
    Determine the type of this value
    <T> T
    getValue(Type<T> type)
    Value of this object.
    <T> T
    getValue(Type<T> type, int index)
    Value at the given index.
    boolean
    Determine whether the value is an array of atoms
    long
    The size of the value of this object.
    long
    size(int index)
    The size of the value at the given index.

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Method Details

    • isArray

      boolean isArray()
      Determine whether the value is an array of atoms
      Returns:
      true if and only if the value is an array of atoms.
    • getType

      Type<?> getType()
      Determine the type of this value
      Returns:
      the type of this value
    • getValue

      @NotNull <T> T getValue(Type<T> type)
      Value of this object. The type of the return value is determined by the target type argument. If type.isArray() is true, this method returns an Iterable of the base type of type containing all values of this property. If the target type is not the same as the type of this property an attempt is made to convert the value to the target type. If the conversion fails an exception is thrown.
      Type Parameters:
      T -
      Parameters:
      type - target type
      Returns:
      the value of this property
      Throws:
      IllegalStateException - if type.isArray() == false and this.isArray() == true. In other words, when trying to convert from an array to an atom.
      IllegalArgumentException - if type refers to an unknown type.
      NumberFormatException - if conversion to a number failed.
      UnsupportedOperationException - if conversion to boolean failed.
    • getValue

      @NotNull <T> T getValue(Type<T> type, int index)
      Value at the given index. The type of the return value is determined by the target type argument. If the target type is not the same as the type of this property an attempt is made to convert the value to the target type. If the conversion fails an exception is thrown.
      Type Parameters:
      T -
      Parameters:
      type - target type
      index -
      Returns:
      the value of this object at the given index
      Throws:
      IndexOutOfBoundsException - if index is less than 0 or greater or equals count().
      IllegalArgumentException - if type refers to an unknown type or if type.isArray() is true.
    • size

      long size()
      The size of the value of this object.
      Returns:
      size of the value of this property
      Throws:
      IllegalStateException - if the value is an array
    • size

      long size(int index)
      The size of the value at the given index.
      Parameters:
      index -
      Returns:
      size of the value at the given index.
      Throws:
      IndexOutOfBoundsException - if index is less than 0 or greater or equals count().
    • count

      int count()
      The number of values of this object. 1 for atoms.
      Returns:
      number of values