Package org.apache.jackrabbit.oak.api
Interface PropertyValue
-
- All Superinterfaces:
java.lang.Comparable<PropertyValue>
- All Known Implementing Classes:
PropertyStateValue
public interface PropertyValue extends java.lang.Comparable<PropertyValue>
Immutable property value. A value is either an atom or an array of atoms.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcount()The number of values of this object.Type<?>getType()Determine the type of this value<T> TgetValue(Type<T> type)Value of this object.<T> TgetValue(Type<T> type, int index)Value at the givenindex.booleanisArray()Determine whether the value is an array of atomslongsize()The size of the value of this object.longsize(int index)The size of the value at the givenindex.
-
-
-
Method Detail
-
isArray
boolean isArray()
Determine whether the value is an array of atoms- Returns:
trueif 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 targettypeargument. Iftype.isArray()is true, this method returns anIterableof thebase typeoftypecontaining 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:
java.lang.IllegalStateException- iftype.isArray() == falseandthis.isArray() == true. In other words, when trying to convert from an array to an atom.java.lang.IllegalArgumentException- iftyperefers to an unknown type.java.lang.NumberFormatException- if conversion to a number failed.java.lang.UnsupportedOperationException- if conversion to boolean failed.
-
getValue
@NotNull <T> T getValue(Type<T> type, int index)
Value at the givenindex. The type of the return value is determined by the targettypeargument. 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 typeindex-- Returns:
- the value of this object at the given
index - Throws:
java.lang.IndexOutOfBoundsException- ifindexis less than0or greater or equalscount().java.lang.IllegalArgumentException- iftyperefers to an unknown type or iftype.isArray()is true.
-
size
long size()
The size of the value of this object.- Returns:
- size of the value of this property
- Throws:
java.lang.IllegalStateException- if the value is an array
-
size
long size(int index)
The size of the value at the givenindex.- Parameters:
index-- Returns:
- size of the value at the given
index. - Throws:
java.lang.IndexOutOfBoundsException- ifindexis less than0or greater or equalscount().
-
count
int count()
The number of values of this object.1for atoms.- Returns:
- number of values
-
-