Class MultiGenericPropertyState

    • Constructor Detail

      • MultiGenericPropertyState

        public MultiGenericPropertyState​(java.lang.String name,
                                         java.lang.Iterable<java.lang.String> values,
                                         Type<?> type)
        Throws:
        java.lang.IllegalArgumentException - if type.isArray() is false
    • Method Detail

      • dateProperty

        public static PropertyState dateProperty​(java.lang.String name,
                                                 java.lang.Iterable<java.lang.String> values)
        Create a multi valued PropertyState from a list of dates.
        Parameters:
        name - The name of the property state
        values - The values of the property state
        Returns:
        The new property state of type Type.DATES
      • nameProperty

        public static PropertyState nameProperty​(java.lang.String name,
                                                 java.lang.Iterable<java.lang.String> values)
        Create a multi valued PropertyState from a list of names. No validation is performed on the strings passed for values.
        Parameters:
        name - The name of the property state
        values - The values of the property state
        Returns:
        The new property state of type Type.NAMES
      • pathProperty

        public static PropertyState pathProperty​(java.lang.String name,
                                                 java.lang.Iterable<java.lang.String> values)
        Create a multi valued PropertyState from a list of paths. No validation is performed on the strings passed for values.
        Parameters:
        name - The name of the property state
        values - The values of the property state
        Returns:
        The new property state of type Type.PATHS
      • referenceProperty

        public static PropertyState referenceProperty​(java.lang.String name,
                                                      java.lang.Iterable<java.lang.String> values)
        Create a multi valued PropertyState from a list of references. No validation is performed on the strings passed for values.
        Parameters:
        name - The name of the property state
        values - The values of the property state
        Returns:
        The new property state of type Type.REFERENCES
      • weakreferenceProperty

        public static PropertyState weakreferenceProperty​(java.lang.String name,
                                                          java.lang.Iterable<java.lang.String> values)
        Create a multi valued PropertyState from a list of weak references. No validation is performed on the strings passed for values.
        Parameters:
        name - The name of the property state
        values - The values of the property state
        Returns:
        The new property state of type Type.WEAKREFERENCES
      • uriProperty

        public static PropertyState uriProperty​(java.lang.String name,
                                                java.lang.Iterable<java.lang.String> values)
        Create a multi valued PropertyState from a list of URIs. No validation is performed on the strings passed for values.
        Parameters:
        name - The name of the property state
        values - The values of the property state
        Returns:
        The new property state of type Type.URIS
      • getConverter

        public Conversions.Converter getConverter​(java.lang.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 target type argument. If type.isArray() is true, this method returns an Iterable of the base type of type 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 the org.apache.jackrabbit.oak.plugins.value.Conversions class.
        Specified by:
        getValue in interface PropertyState
        Overrides:
        getValue in class EmptyPropertyState
        Parameters:
        type - target type
        Returns:
        An empty list if type.isArray() is true.
        Throws:
        java.lang.IllegalStateException - if type.isArray() is false.
        java.lang.IllegalArgumentException - if type is not one of the values defined in Type
      • getValue

        @NotNull
        public <S> S getValue​(Type<S> type,
                              int index)
        Description copied from interface: PropertyState
        Value at the given index. The type of the return value is determined by the target type 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 the org.apache.jackrabbit.oak.plugins.value.Conversions class.
        Specified by:
        getValue in interface PropertyState
        Overrides:
        getValue in class EmptyPropertyState
        Parameters:
        type - target type
        Returns:
        the value of this property at the given index
        Throws:
        java.lang.IllegalArgumentException - if type is not one of the values defined in Type or if type.isArray() is true
        java.lang.IndexOutOfBoundsException - if index >= count().
      • size

        public long size​(int index)
        Description copied from interface: PropertyState
        The size of the value at the given index.
        Specified by:
        size in interface PropertyState
        Overrides:
        size in class EmptyPropertyState
        Returns:
        size of the value at the given index.