Class AbstractAttribute

    • Constructor Detail

      • AbstractAttribute

        protected AbstractAttribute()
        Sole constructor.
    • Method Detail

      • normalizeValue

        public static ByteString normalizeValue​(Attribute attribute,
                                                ByteString value)
        Returns the normalized form of value normalized using attribute's equality matching rule.
        Parameters:
        attribute - The attribute whose equality matching rule should be used for normalization.
        value - The attribute value to be normalized.
        Returns:
        The normalized form of value normalized using attribute's equality matching rule.
      • add

        public boolean add​(Object... values)
        Description copied from interface: Attribute
        Adds all of the provided attribute values to this attribute if they are not already present (optional operation).

        Any attribute values which are not instances of ByteString will be converted using the ByteString.valueOfObject(Object) method.

        Specified by:
        add in interface Attribute
        Parameters:
        values - The attribute values to be added to this attribute.
        Returns:
        true if this attribute changed as a result of this call.
      • addAll

        public boolean addAll​(Collection<? extends ByteString> values)
        Description copied from interface: Attribute
        Adds all of the attribute values contained in values to this attribute if they are not already present (optional operation).

        An invocation of this method is equivalent to:

         attribute.addAll(values, null);
         
        Specified by:
        addAll in interface Attribute
        Specified by:
        addAll in interface Collection<ByteString>
        Specified by:
        addAll in interface Set<ByteString>
        Overrides:
        addAll in class AbstractCollection<ByteString>
        Parameters:
        values - The attribute values to be added to this attribute.
        Returns:
        true if this attribute changed as a result of this call.
      • addAll

        public <T> boolean addAll​(Collection<T> values,
                                  Collection<? super T> duplicateValues)
        Description copied from interface: Attribute
        Adds all of the attribute values contained in values to this attribute if they are not already present (optional operation). Any attribute values which are already present will be added to duplicateValues if specified.

        Any attribute values which are not instances of ByteString will be converted using the ByteString.valueOfObject(Object) method.

        Specified by:
        addAll in interface Attribute
        Type Parameters:
        T - The type of the attribute value objects being added.
        Parameters:
        values - The attribute values to be added to this attribute.
        duplicateValues - A collection into which duplicate values will be added, or null if duplicate values should not be saved.
        Returns:
        true if this attribute changed as a result of this call.
      • equals

        public boolean equals​(Object object)
        Description copied from interface: Attribute
        Returns true if object is an attribute which is equal to this attribute. Two attributes are considered equal if their attribute descriptions are equal, they both have the same number of attribute values, and every attribute value contained in the first attribute is also contained in the second attribute.
        Specified by:
        equals in interface Attribute
        Specified by:
        equals in interface Collection<ByteString>
        Specified by:
        equals in interface Set<ByteString>
        Overrides:
        equals in class AbstractSet<ByteString>
        Parameters:
        object - The object to be tested for equality with this attribute.
        Returns:
        true if object is an attribute which is equal to this attribute, or false if not.
      • firstValue

        public ByteString firstValue()
        Description copied from interface: Attribute
        Returns the first attribute value in this attribute.
        Specified by:
        firstValue in interface Attribute
        Returns:
        The first attribute value in this attribute.
      • forEachNormalizedValue

        public void forEachNormalizedValue​(BiConsumer<? super ByteString,​? super ByteString> action)
        Description copied from interface: Attribute
        Performs the provided action for each value and its associated normalized value in this attribute.
        Specified by:
        forEachNormalizedValue in interface Attribute
        Parameters:
        action - The action to perform which will be passed the normalized value as the first parameter and the user provided value as the second parameter.
      • parse

        public AttributeParser parse()
        Description copied from interface: Attribute
        Returns a parser for this attribute which can be used for decoding values as different types of object.
        Specified by:
        parse in interface Attribute
        Returns:
        A parser for this attribute.
      • matchesApproximateAssertion

        public ConditionResult matchesApproximateAssertion​(Assertion assertion,
                                                           ByteSequence rawAssertion)
        Description copied from interface: Attribute
        Indicates whether this attribute matches the specified assertion using the attribute's default approximate matching rule.
        Specified by:
        matchesApproximateAssertion in interface Attribute
        Parameters:
        assertion - The attribute value assertion compiled using the attribute's default approximate matching rule.
        rawAssertion - The raw assertion value whose syntax is compatible with the attribute's default approximate matching rule.
        Returns:
        ConditionResult.FALSE if the assertion does not match any values in this attribute, ConditionResult.TRUE if the assertion matches at least one value in this attribute, or ConditionResult.UNDEFINED if the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
      • matchesEqualityAssertion

        public ConditionResult matchesEqualityAssertion​(Assertion assertion,
                                                        ByteSequence rawAssertion)
        Description copied from interface: Attribute
        Indicates whether this attribute matches the specified assertion using the attribute's default equality matching rule.
        Specified by:
        matchesEqualityAssertion in interface Attribute
        Parameters:
        assertion - The attribute value assertion compiled using the attribute's default equality matching rule.
        rawAssertion - The raw assertion value whose syntax is compatible with the attribute's default equality matching rule.
        Returns:
        ConditionResult.FALSE if the assertion does not match any values in this attribute, ConditionResult.TRUE if the assertion matches at least one value in this attribute, or ConditionResult.UNDEFINED if the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
      • matchesGreaterOrEqualAssertion

        public ConditionResult matchesGreaterOrEqualAssertion​(Assertion assertion,
                                                              ByteSequence rawAssertion)
        Description copied from interface: Attribute
        Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.
        Specified by:
        matchesGreaterOrEqualAssertion in interface Attribute
        Parameters:
        assertion - The attribute value assertion compiled using the attribute's default ordering matching rule.
        rawAssertion - The raw assertion value whose syntax is compatible with the attribute's default ordering matching rule.
        Returns:
        ConditionResult.FALSE if the assertion does not match any values in this attribute, ConditionResult.TRUE if the assertion matches at least one value in this attribute, or ConditionResult.UNDEFINED if the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
      • matchesLessOrEqualAssertion

        public ConditionResult matchesLessOrEqualAssertion​(Assertion assertion,
                                                           ByteSequence rawAssertion)
        Description copied from interface: Attribute
        Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.
        Specified by:
        matchesLessOrEqualAssertion in interface Attribute
        Parameters:
        assertion - The attribute value assertion compiled using the attribute's default ordering matching rule.
        rawAssertion - The raw assertion value whose syntax is compatible with the attribute's default ordering matching rule.
        Returns:
        ConditionResult.FALSE if the assertion does not match any values in this attribute, ConditionResult.TRUE if the assertion matches at least one value in this attribute, or ConditionResult.UNDEFINED if the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
      • matchesSubstringAssertion

        public ConditionResult matchesSubstringAssertion​(Assertion assertion,
                                                         ByteSequence rawInitialSubstring,
                                                         List<? extends ByteSequence> rawAnySubstrings,
                                                         ByteSequence rawFinalSubstring)
        Description copied from interface: Attribute
        Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.
        Specified by:
        matchesSubstringAssertion in interface Attribute
        Parameters:
        assertion - The attribute value assertion compiled using the attribute's default ordering matching rule.
        rawInitialSubstring - The assertion's initial sub-string, may be null if either rawFinalSubstring or rawAnySubstrings are specified.
        rawAnySubstrings - The assertion's intermediate sub-strings, may be empty if either rawFinalSubstring or rawAnySubstrings are specified.
        rawFinalSubstring - The final sub-string, may be null if either rawInitialSubstring or rawAnySubstrings are specified.
        Returns:
        ConditionResult.FALSE if the assertion does not match any values in this attribute, ConditionResult.TRUE if the assertion matches at least one value in this attribute, or ConditionResult.UNDEFINED if the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
      • removeAll

        public boolean removeAll​(Collection<?> values)
        Description copied from interface: Attribute
        Removes all of the attribute values contained in values from this attribute if they are present (optional operation).

        Any attribute values which are not instances of ByteString will be converted using the ByteString.valueOfObject(Object) method.

        An invocation of this method is equivalent to:

         attribute.removeAll(values, null);
         
        Specified by:
        removeAll in interface Attribute
        Specified by:
        removeAll in interface Collection<ByteString>
        Specified by:
        removeAll in interface Set<ByteString>
        Overrides:
        removeAll in class AbstractSet<ByteString>
        Parameters:
        values - The attribute values to be removed from this attribute.
        Returns:
        true if this attribute changed as a result of this call.
      • removeAll

        public <T> boolean removeAll​(Collection<T> values,
                                     Collection<? super T> missingValues)
        Description copied from interface: Attribute
        Removes all of the attribute values contained in values from this attribute if they are present (optional operation). Any attribute values which are not already present will be added to missingValues if specified.

        Any attribute values which are not instances of ByteString will be converted using the ByteString.valueOfObject(Object) method.

        Specified by:
        removeAll in interface Attribute
        Type Parameters:
        T - The type of the attribute value objects being removed.
        Parameters:
        values - The attribute values to be removed from this attribute.
        missingValues - A collection into which missing values will be added, or null if missing values should not be saved.
        Returns:
        true if this attribute changed as a result of this call.
      • retainAll

        public boolean retainAll​(Collection<?> values)
        Description copied from interface: Attribute
        Retains only the attribute values in this attribute which are contained in values (optional operation).

        Any attribute values which are not instances of ByteString will be converted using the ByteString.valueOfObject(Object) method.

        An invocation of this method is equivalent to:

         attribute.retainAll(values, null);
         
        Specified by:
        retainAll in interface Attribute
        Specified by:
        retainAll in interface Collection<ByteString>
        Specified by:
        retainAll in interface Set<ByteString>
        Overrides:
        retainAll in class AbstractCollection<ByteString>
        Parameters:
        values - The attribute values to be retained in this attribute.
        Returns:
        true if this attribute changed as a result of this call.
      • retainAll

        public <T> boolean retainAll​(Collection<T> values,
                                     Collection<? super T> missingValues)
        Description copied from interface: Attribute
        Retains only the attribute values in this attribute which are contained in values (optional operation). Any attribute values which are not already present will be added to missingValues if specified.

        Any attribute values which are not instances of ByteString will be converted using the ByteString.valueOfObject(Object) method.

        Specified by:
        retainAll in interface Attribute
        Type Parameters:
        T - The type of the attribute value objects being retained.
        Parameters:
        values - The attribute values to be retained in this attribute.
        missingValues - A collection into which missing values will be added, or null if missing values should not be saved.
        Returns:
        true if this attribute changed as a result of this call.
      • toArray

        public ByteString[] toArray()
        Description copied from interface: Attribute
        Returns an array containing all of the attribute values contained in this attribute.

        If this attribute makes any guarantees as to what order its attribute values are returned by its iterator, this method must return the attribute values in the same order.

        The returned array will be "safe" in that no references to it are maintained by this attribute. The caller is thus free to modify the returned array.

        Specified by:
        toArray in interface Attribute
        Specified by:
        toArray in interface Collection<ByteString>
        Specified by:
        toArray in interface Set<ByteString>
        Overrides:
        toArray in class AbstractCollection<ByteString>
        Returns:
        An array containing all of the attribute values contained in this attribute.