Class MultiGenericPropertyState
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.memory.AbstractPropertyState
-
- org.apache.jackrabbit.oak.plugins.memory.EmptyPropertyState
-
- org.apache.jackrabbit.oak.plugins.memory.MultiGenericPropertyState
-
- All Implemented Interfaces:
PropertyState
public class MultiGenericPropertyState extends EmptyPropertyState
-
-
Field Summary
Fields Modifier and Type Field Description protected List<T>
values
-
Constructor Summary
Constructors Constructor Description MultiGenericPropertyState(String name, Iterable<String> values, Type<?> type)
-
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
dateProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of dates.Conversions.Converter
getConverter(String value)
Create a converter for converting a value to other types.Type<?>
getType()
Determine the type of this property<S> S
getValue(Type<S> type)
Value of this property.<S> S
getValue(Type<S> type, int index)
Value at the givenindex
.static PropertyState
nameProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of names.static PropertyState
pathProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of paths.static PropertyState
referenceProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of references.long
size(int index)
The size of the value at the givenindex
.static PropertyState
uriProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of URIs.static PropertyState
weakreferenceProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of weak references.-
Methods inherited from class org.apache.jackrabbit.oak.plugins.memory.EmptyPropertyState
emptyProperty, getName, isArray, size
-
-
-
-
Field Detail
-
values
protected final List<T> values
-
-
Constructor Detail
-
MultiGenericPropertyState
public MultiGenericPropertyState(String name, Iterable<String> values, Type<?> type)
- Throws:
IllegalArgumentException
- iftype.isArray()
isfalse
-
-
Method Detail
-
dateProperty
public static PropertyState dateProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of dates.- Parameters:
name
- The name of the property statevalues
- The values of the property state- Returns:
- The new property state of type
Type.DATES
-
nameProperty
public static PropertyState nameProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of names. No validation is performed on the strings passed forvalues
.- Parameters:
name
- The name of the property statevalues
- The values of the property state- Returns:
- The new property state of type
Type.NAMES
-
pathProperty
public static PropertyState pathProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of paths. No validation is performed on the strings passed forvalues
.- Parameters:
name
- The name of the property statevalues
- The values of the property state- Returns:
- The new property state of type
Type.PATHS
-
referenceProperty
public static PropertyState referenceProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of references. No validation is performed on the strings passed forvalues
.- Parameters:
name
- The name of the property statevalues
- The values of the property state- Returns:
- The new property state of type
Type.REFERENCES
-
weakreferenceProperty
public static PropertyState weakreferenceProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of weak references. No validation is performed on the strings passed forvalues
.- Parameters:
name
- The name of the property statevalues
- The values of the property state- Returns:
- The new property state of type
Type.WEAKREFERENCES
-
uriProperty
public static PropertyState uriProperty(String name, Iterable<String> values)
Create a multi valuedPropertyState
from a list of URIs. No validation is performed on the strings passed forvalues
.- Parameters:
name
- The name of the property statevalues
- The values of the property state- Returns:
- The new property state of type
Type.URIS
-
getConverter
public Conversions.Converter getConverter(String value)
Create a converter for converting a value to other types.- Parameters:
value
- The value to convert- 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
-
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 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.- Specified by:
getValue
in interfacePropertyState
- Overrides:
getValue
in classEmptyPropertyState
- Parameters:
type
- target type- Returns:
- An empty list if
type.isArray()
istrue
. - Throws:
IllegalStateException
- iftype.isArray()
isfalse
.IllegalArgumentException
- iftype
is not one of the values defined inType
-
getValue
@NotNull public <S> S getValue(Type<S> 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.- Specified by:
getValue
in interfacePropertyState
- Overrides:
getValue
in classEmptyPropertyState
- Parameters:
type
- target type- Returns:
- the value of this property at the given
index
- Throws:
IllegalArgumentException
- iftype
is not one of the values defined inType
or iftype.isArray()
istrue
IndexOutOfBoundsException
- ifindex >= count()
.
-
count
public final int count()
Description copied from interface:PropertyState
The number of values of this property.1
for atoms.- Specified by:
count
in interfacePropertyState
- Overrides:
count
in classEmptyPropertyState
- Returns:
0
-
size
public long size(int index)
Description copied from interface:PropertyState
The size of the value at the givenindex
.- Specified by:
size
in interfacePropertyState
- Overrides:
size
in classEmptyPropertyState
- Returns:
- size of the value at the given
index
.
-
-