Class EmptyPropertyState

java.lang.Object
org.apache.jackrabbit.oak.plugins.memory.AbstractPropertyState
org.apache.jackrabbit.oak.plugins.memory.EmptyPropertyState
All Implemented Interfaces:
PropertyState
Direct Known Subclasses:
BinaryPropertyState, BooleanPropertyState, DecimalPropertyState, DoublePropertyState, GenericPropertyState, LongPropertyState, MultiBinaryPropertyState, MultiBooleanPropertyState, MultiDecimalPropertyState, MultiDoublePropertyState, MultiGenericPropertyState, MultiLongPropertyState, MultiStringPropertyState, StringPropertyState

public abstract class EmptyPropertyState extends AbstractPropertyState
Abstract base class for PropertyState implementations providing default implementation which correspond to a property without any value.
  • Method Details

    • emptyProperty

      public static PropertyState emptyProperty(String name, Type<?> type)
      Create an empty PropertyState
      Parameters:
      name - The name of the property state
      type - The type of the property state
      Returns:
      The new property state
      Throws:
      IllegalArgumentException - if @code type.isArray()} is false.
    • getName

      @NotNull public @NotNull String getName()
      Returns:
      the name of this property state
    • isArray

      public boolean isArray()
      Description copied from interface: PropertyState
      Determine whether the value is an array of atoms
      Returns:
      true
    • getValue

      @NotNull public <T> T getValue(Type<T> type)
      Description copied from interface: PropertyState
      Value of this property. 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. The actual conversions which take place are those defined in the org.apache.jackrabbit.oak.plugins.value.Conversions class.
      Type Parameters:
      T -
      Parameters:
      type - target type
      Returns:
      An empty list if type.isArray() is true.
      Throws:
      IllegalStateException - type.isArray() is false.
    • getValue

      @NotNull public <T> T getValue(Type<T> type, int index)
      Description copied from interface: PropertyState
      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. The actual conversions which take place are those defined in the org.apache.jackrabbit.oak.plugins.value.Conversions class.
      Type Parameters:
      T -
      Parameters:
      type - target type
      index -
      Returns:
      the value of this property at the given index
      Throws:
      IndexOutOfBoundsException - always
    • size

      public long size()
      Description copied from interface: PropertyState
      The size of the value of this property.
      Returns:
      size of the value of this property
      Throws:
      IllegalStateException - always
    • size

      public long size(int index)
      Description copied from interface: PropertyState
      The size of the value at the given index.
      Parameters:
      index -
      Returns:
      size of the value at the given index.
      Throws:
      IndexOutOfBoundsException - always
    • count

      public int count()
      Description copied from interface: PropertyState
      The number of values of this property. 1 for atoms.
      Returns:
      0