Class GenericDescriptors
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.descriptors.GenericDescriptors
-
- All Implemented Interfaces:
Descriptors
public class GenericDescriptors extends java.lang.Object implements Descriptors
Default implementation of theDescriptorsinterface. Supports overlying of given default descriptors.
-
-
Constructor Summary
Constructors Constructor Description GenericDescriptors()Constructs an empty descriptors set.GenericDescriptors(@Nullable Descriptors base)Constructs a descriptors set that uses the givenbasedescriptors as base.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull java.lang.String[]getKeys()Returns a string array holding all descriptor keys available for this implementation, both the standard descriptors defined by the string constants in this interface and any implementation-specific descriptors.@Nullable javax.jcr.ValuegetValue(@NotNull java.lang.String key)The value of a single-value descriptor is found by passing the key for that descriptor to this method.@Nullable javax.jcr.Value[]getValues(@NotNull java.lang.String key)The value array of a multi-value descriptor is found by passing the key for that descriptor to this method.booleanisSingleValueDescriptor(@NotNull java.lang.String key)Returnstrueifkeyis a valid single-value descriptor; otherwise returnsfalsebooleanisStandardDescriptor(@NotNull java.lang.String key)Returnstrueifkeyis a standard descriptor defined by the string constants in this interface andfalseif it is either a valid implementation-specific key or not a valid key.GenericDescriptorsput(@NotNull java.lang.String name, @NotNull javax.jcr.Value[] values, boolean singleValued, boolean standard)Adds a new descriptor to this set of descriptors which overlay the ones from the base set.GenericDescriptorsput(@NotNull java.lang.String name, @NotNull javax.jcr.Value value, boolean singleValued, boolean standard)Adds a new descriptor to this set of descriptors which overlay the ones from the base set.
-
-
-
Constructor Detail
-
GenericDescriptors
public GenericDescriptors()
Constructs an empty descriptors set.
-
GenericDescriptors
public GenericDescriptors(@Nullable @Nullable Descriptors base)Constructs a descriptors set that uses the givenbasedescriptors as base.- Parameters:
base- the base descriptors ornull
-
-
Method Detail
-
getKeys
@NotNull public @NotNull java.lang.String[] getKeys()
Returns a string array holding all descriptor keys available for this implementation, both the standard descriptors defined by the string constants in this interface and any implementation-specific descriptors. Used in conjunction withDescriptors.getValue(String key)andDescriptors.getValues(String key)to query information about this repository implementation. Note: If this descriptors are based on default descriptors, the returns string array is a merge of this and the base's keys.- Specified by:
getKeysin interfaceDescriptors- Returns:
- a string array holding all descriptor keys.
-
isStandardDescriptor
public boolean isStandardDescriptor(@NotNull @NotNull java.lang.String key)Returnstrueifkeyis a standard descriptor defined by the string constants in this interface andfalseif it is either a valid implementation-specific key or not a valid key. Note: If the descriptor withkeydoes not exist in this set, the call is delegated to the base descriptors.- Specified by:
isStandardDescriptorin interfaceDescriptors- Parameters:
key- a descriptor key.- Returns:
- whether
keyis a standard descriptor.
-
isSingleValueDescriptor
public boolean isSingleValueDescriptor(@NotNull @NotNull java.lang.String key)Returnstrueifkeyis a valid single-value descriptor; otherwise returnsfalseNote: If the descriptor withkeydoes not exist in this set, the call is delegated to the base descriptors.- Specified by:
isSingleValueDescriptorin interfaceDescriptors- Parameters:
key- a descriptor key.- Returns:
- whether the specified descriptor is multi-valued.
-
getValue
@Nullable public @Nullable javax.jcr.Value getValue(@NotNull @NotNull java.lang.String key)The value of a single-value descriptor is found by passing the key for that descriptor to this method. Ifkeyis the key of a multi-value descriptor or not a valid key this method returnsnull. Note: If the descriptor withkeydoes not exist in this set, the call is delegated to the base descriptors.- Specified by:
getValuein interfaceDescriptors- Parameters:
key- a descriptor key.- Returns:
- The value of the indicated descriptor
-
getValues
@Nullable public @Nullable javax.jcr.Value[] getValues(@NotNull @NotNull java.lang.String key)The value array of a multi-value descriptor is found by passing the key for that descriptor to this method. Ifkeyis the key of a single-value descriptor then this method returns that value as an array of size one. Ifkeyis not a valid key this method returnsnull. Note: If the descriptor withkeydoes not exist in this set, the call is delegated to the base descriptors.- Specified by:
getValuesin interfaceDescriptors- Parameters:
key- a descriptor key.- Returns:
- the value array for the indicated descriptor
-
put
public GenericDescriptors put(@NotNull @NotNull java.lang.String name, @NotNull @NotNull javax.jcr.Value[] values, boolean singleValued, boolean standard)
Adds a new descriptor to this set of descriptors which overlay the ones from the base set.- Parameters:
name- descriptor namevalues- array of descriptor valuessingleValued- flag indicating if this is single valued descriptor. seeDescriptors.isSingleValueDescriptor(String)standard- flag indicating if this is a standard descriptor. seeDescriptors.isStandardDescriptor(String)- Returns:
thissuitable for chaining.
-
put
public GenericDescriptors put(@NotNull @NotNull java.lang.String name, @NotNull @NotNull javax.jcr.Value value, boolean singleValued, boolean standard)
Adds a new descriptor to this set of descriptors which overlay the ones from the base set.- Parameters:
name- descriptor namevalue- descriptor valuesingleValued- flag indicating if this is single valued descriptor. seeDescriptors.isSingleValueDescriptor(String)standard- flag indicating if this is a standard descriptor. seeDescriptors.isStandardDescriptor(String)- Returns:
thissuitable for chaining.
-
-