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 forPropertyStateimplementations providing default implementation which correspond to a property without any value.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcount()The number of values of this property.static PropertyStateemptyProperty(java.lang.String name, Type<?> type)Create an emptyPropertyState@NotNull java.lang.StringgetName()<T> TgetValue(Type<T> type)Value of this property.<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 property.longsize(int index)The size of the value at the givenindex.-
Methods inherited from class org.apache.jackrabbit.oak.plugins.memory.AbstractPropertyState
equal, equals, hashCode, hashCode, toString, toString
-
Methods inherited from interface org.apache.jackrabbit.oak.api.PropertyState
getType
-
-
-
-
Method Detail
-
emptyProperty
public static PropertyState emptyProperty(java.lang.String name, Type<?> type)
Create an emptyPropertyState- Parameters:
name- The name of the property statetype- The type of the property state- Returns:
- The new property state
- Throws:
java.lang.IllegalArgumentException- if @code type.isArray()} isfalse.
-
getName
@NotNull public @NotNull java.lang.String getName()
- Returns:
- the name of this property state
-
isArray
public boolean isArray()
Description copied from interface:PropertyStateDetermine whether the value is an array of atoms- Returns:
true
-
getValue
@NotNull public <T> T getValue(Type<T> type)
Description copied from interface:PropertyStateValue of this property. 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. The actual conversions which take place are those defined in theorg.apache.jackrabbit.oak.plugins.value.Conversionsclass.- Parameters:
type- target type- Returns:
- An empty list if
type.isArray()istrue. - Throws:
java.lang.IllegalStateException-type.isArray()isfalse.
-
getValue
@NotNull public <T> T getValue(Type<T> type, int index)
Description copied from interface:PropertyStateValue 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. The actual conversions which take place are those defined in theorg.apache.jackrabbit.oak.plugins.value.Conversionsclass.- Parameters:
type- target type- Returns:
- the value of this property at the given
index - Throws:
java.lang.IndexOutOfBoundsException- always
-
size
public long size()
Description copied from interface:PropertyStateThe size of the value of this property.- Returns:
- size of the value of this property
- Throws:
java.lang.IllegalStateException- always
-
size
public long size(int index)
Description copied from interface:PropertyStateThe size of the value at the givenindex.- Returns:
- size of the value at the given
index. - Throws:
java.lang.IndexOutOfBoundsException- always
-
count
public int count()
Description copied from interface:PropertyStateThe number of values of this property.1for atoms.- Returns:
0
-
-