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:
 PropertyState
public class GenericPropertyState extends EmptyPropertyState
 
- 
- 
Constructor Summary
Constructors Constructor Description GenericPropertyState(@NotNull java.lang.String name, @NotNull java.lang.String value, @NotNull Type<?> type) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcount()The number of values of this property.static PropertyStatedateProperty(java.lang.String name, java.lang.String value)Create aPropertyStatefrom a date.Conversions.ConvertergetConverter()Create a converter for converting the value of this property to other types.Type<?>getType()Determine the type of this propertyjava.lang.StringgetValue()The value of this property<S> SgetValue(Type<S> type)Value of this property.<S> SgetValue(Type<S> type, int index)Value at the givenindex.booleanisArray()Determine whether the value is an array of atomsstatic PropertyStatenameProperty(java.lang.String name, java.lang.String value)Create aPropertyStatefrom a name.static PropertyStatepathProperty(java.lang.String name, java.lang.String value)Create aPropertyStatefrom a path.static PropertyStatereferenceProperty(java.lang.String name, java.lang.String value)Create aPropertyStatefrom a reference.longsize()The size of the value of this property.longsize(int index)The size of the value at the givenindex.static PropertyStateuriProperty(java.lang.String name, java.lang.String value)Create aPropertyStatefrom a URI.static PropertyStateweakreferenceProperty(java.lang.String name, java.lang.String value)Create aPropertyStatefrom a weak reference.- 
Methods inherited from class org.apache.jackrabbit.oak.plugins.memory.EmptyPropertyState
emptyProperty, getName 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
GenericPropertyState
public GenericPropertyState(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String value, @NotNull @NotNull Type<?> type)- Throws:
 java.lang.IllegalArgumentException- iftype.isArray()istrue
 
 - 
 
- 
Method Detail
- 
dateProperty
public static PropertyState dateProperty(java.lang.String name, java.lang.String value)
Create aPropertyStatefrom 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 PropertyState nameProperty(java.lang.String name, java.lang.String value)
Create aPropertyStatefrom 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 PropertyState pathProperty(java.lang.String name, java.lang.String value)
Create aPropertyStatefrom 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 PropertyState referenceProperty(java.lang.String name, java.lang.String value)
Create aPropertyStatefrom 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 PropertyState weakreferenceProperty(java.lang.String name, java.lang.String value)
Create aPropertyStatefrom 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 PropertyState uriProperty(java.lang.String name, java.lang.String value)
Create aPropertyStatefrom 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 Type<?> getType()
Description copied from interface:PropertyStateDetermine the type of this property- Returns:
 - the type of this property
 
 
- 
isArray
public boolean isArray()
Description copied from interface:PropertyStateDetermine whether the value is an array of atoms- Specified by:
 isArrayin interfacePropertyState- Overrides:
 isArrayin classEmptyPropertyState- Returns:
 false
 
- 
getValue
@NotNull public <S> S getValue(Type<S> 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.- Specified by:
 getValuein interfacePropertyState- Overrides:
 getValuein classEmptyPropertyState- Parameters:
 type- target type- Returns:
 - An empty list if 
type.isArray()istrue. - Throws:
 java.lang.IllegalArgumentException- iftypeis not one of the values defined inType.
 
- 
getValue
@NotNull public <S> S getValue(Type<S> 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.- Specified by:
 getValuein interfacePropertyState- Overrides:
 getValuein classEmptyPropertyState- Parameters:
 type- target type- Returns:
 - the value of this property at the given 
index - Throws:
 java.lang.IllegalArgumentException- iftype.isArrayistruejava.lang.IndexOutOfBoundsException- ifindex != 0
 
- 
size
public long size()
Description copied from interface:PropertyStateThe size of the value of this property.- Specified by:
 sizein interfacePropertyState- Overrides:
 sizein classEmptyPropertyState- Returns:
 getString().length()
 
- 
size
public long size(int index)
Description copied from interface:PropertyStateThe size of the value at the givenindex.- Specified by:
 sizein interfacePropertyState- Overrides:
 sizein classEmptyPropertyState- Returns:
 size- Throws:
 java.lang.IndexOutOfBoundsException- ifindex != 0
 
- 
count
public int count()
Description copied from interface:PropertyStateThe number of values of this property.1for atoms.- Specified by:
 countin interfacePropertyState- Overrides:
 countin classEmptyPropertyState- Returns:
 1
 
 - 
 
 -