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 forPropertyState
implementations providing default implementation which correspond to a property without any value.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EmptyPropertyState(@NotNull String name)
Create a new property state with the givenname
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
count()
The number of values of this property.static PropertyState
emptyProperty(String name, Type<?> type)
Create an emptyPropertyState
@NotNull String
getName()
<T> T
getValue(Type<T> type)
Value of this property.<T> T
getValue(Type<T> type, int index)
Value at the givenindex
.boolean
isArray()
Determine whether the value is an array of atomslong
size()
The size of the value of this property.long
size(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 class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.oak.api.PropertyState
getType
-
-
-
-
Constructor Detail
-
EmptyPropertyState
protected EmptyPropertyState(@NotNull @NotNull String name)
Create a new property state with the givenname
- Parameters:
name
- The name of the property state.
-
-
Method Detail
-
emptyProperty
public static PropertyState emptyProperty(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:
IllegalArgumentException
- if @code type.isArray()} isfalse
.
-
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 targettype
argument. Iftype.isArray()
is true, this method returns anIterable
of thebase type
oftype
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 theorg.apache.jackrabbit.oak.plugins.value.Conversions
class.- Parameters:
type
- target type- Returns:
- An empty list if
type.isArray()
istrue
. - Throws:
IllegalStateException
-type.isArray()
isfalse
.
-
getValue
@NotNull public <T> T getValue(Type<T> type, int index)
Description copied from interface:PropertyState
Value at the givenindex
. The type of the return value is determined by the targettype
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 theorg.apache.jackrabbit.oak.plugins.value.Conversions
class.- Parameters:
type
- target type- 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 givenindex
.- 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
-
-