Class BooleanPropertyState

All Implemented Interfaces:
PropertyState

public class BooleanPropertyState extends EmptyPropertyState
  • Constructor Details

    • BooleanPropertyState

      public BooleanPropertyState(@NotNull @NotNull String name, boolean value)
  • Method Details

    • booleanProperty

      public static PropertyState booleanProperty(@NotNull @NotNull String name, boolean value)
      Create a PropertyState from a boolean.
      Parameters:
      name - The name of the property state
      value - The value of the property state
      Returns:
      The new property state of type Type.BOOLEAN
    • getValue

      public Boolean getValue()
      The value of this property
      Returns:
      Value of this property
    • getConverter

      public Conversions.Converter getConverter()
      Create a converter for converting the value of this property to other types.
      Returns:
      A converter for the value of this property
    • getType

      public Type<?> getType()
      Description copied from interface: PropertyState
      Determine the type of this property
      Returns:
      the type of this property
    • isArray

      public boolean isArray()
      Description copied from interface: PropertyState
      Determine whether the value is an array of atoms
      Specified by:
      isArray in interface PropertyState
      Overrides:
      isArray in class EmptyPropertyState
      Returns:
      false
    • getValue

      @NotNull public <S> S getValue(Type<S> 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.
      Specified by:
      getValue in interface PropertyState
      Overrides:
      getValue in class EmptyPropertyState
      Type Parameters:
      S -
      Parameters:
      type - target type
      Returns:
      An empty list if type.isArray() is true.
      Throws:
      IllegalArgumentException - if type is not one of the values defined in Type.
    • getValue

      @NotNull public <S> S getValue(Type<S> 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.
      Specified by:
      getValue in interface PropertyState
      Overrides:
      getValue in class EmptyPropertyState
      Type Parameters:
      S -
      Parameters:
      type - target type
      index -
      Returns:
      the value of this property at the given index
      Throws:
      IllegalArgumentException - if type.isArray is true
      IndexOutOfBoundsException - if index != 0
    • size

      public long size()
      Description copied from interface: PropertyState
      The size of the value of this property.
      Specified by:
      size in interface PropertyState
      Overrides:
      size in class EmptyPropertyState
      Returns:
      getString().length()
    • size

      public long size(int index)
      Description copied from interface: PropertyState
      The size of the value at the given index.
      Specified by:
      size in interface PropertyState
      Overrides:
      size in class EmptyPropertyState
      Parameters:
      index -
      Returns:
      size
      Throws:
      IndexOutOfBoundsException - if index != 0
    • count

      public int count()
      Description copied from interface: PropertyState
      The number of values of this property. 1 for atoms.
      Specified by:
      count in interface PropertyState
      Overrides:
      count in class EmptyPropertyState
      Returns:
      1