Class GenericPropertyState
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.memory.AbstractPropertyState
-
- org.apache.jackrabbit.oak.plugins.memory.EmptyPropertyState
-
- org.apache.jackrabbit.oak.plugins.memory.GenericPropertyState
-
- All Implemented Interfaces:
org.apache.jackrabbit.oak.api.PropertyState
public class GenericPropertyState extends EmptyPropertyState
-
-
Constructor Summary
Constructors Constructor Description GenericPropertyState(@NotNull java.lang.String name, @NotNull java.lang.String value, @NotNull org.apache.jackrabbit.oak.api.Type<?> type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
count()
static org.apache.jackrabbit.oak.api.PropertyState
dateProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a date.Conversions.Converter
getConverter()
Create a converter for converting the value of this property to other types.org.apache.jackrabbit.oak.api.Type<?>
getType()
java.lang.String
getValue()
The value of this property<S> S
getValue(org.apache.jackrabbit.oak.api.Type<S> type)
<S> S
getValue(org.apache.jackrabbit.oak.api.Type<S> type, int index)
boolean
isArray()
static org.apache.jackrabbit.oak.api.PropertyState
nameProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a name.static org.apache.jackrabbit.oak.api.PropertyState
pathProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a path.static org.apache.jackrabbit.oak.api.PropertyState
referenceProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a reference.long
size()
long
size(int index)
static org.apache.jackrabbit.oak.api.PropertyState
uriProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a URI.static org.apache.jackrabbit.oak.api.PropertyState
weakreferenceProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a weak reference.-
Methods inherited from class org.apache.jackrabbit.oak.plugins.memory.EmptyPropertyState
emptyProperty, getName
-
-
-
-
Method Detail
-
dateProperty
public static org.apache.jackrabbit.oak.api.PropertyState dateProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a date. No validation is performed on the string passed forvalue
.- Parameters:
name
- The name of the property statevalue
- The value of the property state- Returns:
- The new property state of type
Type.DATE
-
nameProperty
public static org.apache.jackrabbit.oak.api.PropertyState nameProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a name. No validation is performed on the string passed forvalue
.- Parameters:
name
- The name of the property statevalue
- The value of the property state- Returns:
- The new property state of type
Type.NAME
-
pathProperty
public static org.apache.jackrabbit.oak.api.PropertyState pathProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a path. No validation is performed on the string passed forvalue
.- Parameters:
name
- The name of the property statevalue
- The value of the property state- Returns:
- The new property state of type
Type.PATH
-
referenceProperty
public static org.apache.jackrabbit.oak.api.PropertyState referenceProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a reference. No validation is performed on the string passed forvalue
.- Parameters:
name
- The name of the property statevalue
- The value of the property state- Returns:
- The new property state of type
Type.REFERENCE
-
weakreferenceProperty
public static org.apache.jackrabbit.oak.api.PropertyState weakreferenceProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a weak reference. No validation is performed on the string passed forvalue
.- Parameters:
name
- The name of the property statevalue
- The value of the property state- Returns:
- The new property state of type
Type.WEAKREFERENCE
-
uriProperty
public static org.apache.jackrabbit.oak.api.PropertyState uriProperty(java.lang.String name, java.lang.String value)
Create aPropertyState
from a URI. No validation is performed on the string passed forvalue
.- Parameters:
name
- The name of the property statevalue
- The value of the property state- Returns:
- The new property state of type
Type.URI
-
getValue
public java.lang.String 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 org.apache.jackrabbit.oak.api.Type<?> getType()
-
isArray
public boolean isArray()
- Specified by:
isArray
in interfaceorg.apache.jackrabbit.oak.api.PropertyState
- Overrides:
isArray
in classEmptyPropertyState
- Returns:
false
-
getValue
@NotNull public <S> S getValue(org.apache.jackrabbit.oak.api.Type<S> type)
- Specified by:
getValue
in interfaceorg.apache.jackrabbit.oak.api.PropertyState
- Overrides:
getValue
in classEmptyPropertyState
- Returns:
- An empty list if
type.isArray()
istrue
. - Throws:
java.lang.IllegalArgumentException
- iftype
is not one of the values defined inType
.
-
getValue
@NotNull public <S> S getValue(org.apache.jackrabbit.oak.api.Type<S> type, int index)
- Specified by:
getValue
in interfaceorg.apache.jackrabbit.oak.api.PropertyState
- Overrides:
getValue
in classEmptyPropertyState
- Throws:
java.lang.IllegalArgumentException
- iftype.isArray
istrue
java.lang.IndexOutOfBoundsException
- ifindex != 0
-
size
public long size()
- Specified by:
size
in interfaceorg.apache.jackrabbit.oak.api.PropertyState
- Overrides:
size
in classEmptyPropertyState
- Returns:
getString().length()
-
size
public long size(int index)
- Specified by:
size
in interfaceorg.apache.jackrabbit.oak.api.PropertyState
- Overrides:
size
in classEmptyPropertyState
- Returns:
size
- Throws:
java.lang.IndexOutOfBoundsException
- ifindex != 0
-
count
public int count()
- Specified by:
count
in interfaceorg.apache.jackrabbit.oak.api.PropertyState
- Overrides:
count
in classEmptyPropertyState
- Returns:
1
-
-