Class BinaryPropertyState
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.memory.AbstractPropertyState
-
- org.apache.jackrabbit.oak.plugins.memory.EmptyPropertyState
-
- org.apache.jackrabbit.oak.plugins.memory.BinaryPropertyState
-
- All Implemented Interfaces:
PropertyState
public class BinaryPropertyState extends EmptyPropertyState
-
-
Constructor Summary
Constructors Constructor Description BinaryPropertyState(@NotNull java.lang.String name, @NotNull Blob value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PropertyState
binaryProperty(@NotNull java.lang.String name, @org.jetbrains.annotations.NotNull byte[] value)
Create aPropertyState
from an array of bytes.static PropertyState
binaryProperty(@NotNull java.lang.String name, @NotNull java.lang.String value)
Create aPropertyState
from an array of bytes.static PropertyState
binaryProperty(@NotNull java.lang.String name, @NotNull Value value)
Create aPropertyState
from aValue
.static PropertyState
binaryProperty(@NotNull java.lang.String name, @NotNull Blob value)
Create aPropertyState
from aBlob
.int
count()
The number of values of this property.Conversions.Converter
getConverter()
Create a converter for converting the value of this property to other types.Type<?>
getType()
Determine the type of this propertyBlob
getValue()
The value 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
.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.EmptyPropertyState
emptyProperty, getName
-
-
-
-
Constructor Detail
-
BinaryPropertyState
public BinaryPropertyState(@NotNull @NotNull java.lang.String name, @NotNull @NotNull Blob value)
-
-
Method Detail
-
binaryProperty
public static PropertyState binaryProperty(@NotNull @NotNull java.lang.String name, @NotNull @org.jetbrains.annotations.NotNull byte[] value)
Create aPropertyState
from an array of bytes.- Parameters:
name
- The name of the property statevalue
- The value of the property state- Returns:
- The new property state of type
Type.BINARY
-
binaryProperty
public static PropertyState binaryProperty(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String value)
Create aPropertyState
from an array of bytes.- Parameters:
name
- The name of the property statevalue
- The value of the property state- Returns:
- The new property state of type
Type.BINARY
-
binaryProperty
public static PropertyState binaryProperty(@NotNull @NotNull java.lang.String name, @NotNull @NotNull Blob value)
Create aPropertyState
from aBlob
.- Parameters:
name
- The name of the property statevalue
- The value of the property state- Returns:
- The new property state of type
Type.BINARY
-
binaryProperty
public static PropertyState binaryProperty(@NotNull @NotNull java.lang.String name, @NotNull @NotNull Value value) throws RepositoryException
Create aPropertyState
from aValue
.- Parameters:
name
- The name of the property statevalue
- The value of the property state- Returns:
- The new property state of type
Type.BINARY
- Throws:
RepositoryException
-
getValue
public Blob 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
-
size
public long size()
Description copied from interface:PropertyState
The size of the value of this property.- Specified by:
size
in interfacePropertyState
- Returns:
getString().length()
-
getType
public Type<?> getType()
Description copied from interface:PropertyState
Determine the type of this property- Returns:
- the type of this property
-
isArray
public boolean isArray()
Description copied from interface:PropertyState
Determine whether the value is an array of atoms- Specified by:
isArray
in interfacePropertyState
- Overrides:
isArray
in classEmptyPropertyState
- Returns:
false
-
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:
java.lang.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:
java.lang.IllegalArgumentException
- iftype.isArray
istrue
java.lang.IndexOutOfBoundsException
- ifindex != 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
- Throws:
java.lang.IndexOutOfBoundsException
- ifindex != 0
-
count
public 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:
1
-
-