Class MatchedValuesFilter


  • public class MatchedValuesFilter
    extends Object
    This class defines a filter that may be used in conjunction with the matched values control to indicate which particular values of a multivalued attribute should be returned. The matched values filter is essentially a subset of an LDAP search filter, lacking support for AND, OR, and NOT components, and lacking support for the dnAttributes component of extensible matching filters.
    • Field Detail

      • EQUALITY_MATCH_TYPE

        public static final byte EQUALITY_MATCH_TYPE
        The BER type associated with the equalityMatch filter type.
        See Also:
        Constant Field Values
      • SUBSTRINGS_TYPE

        public static final byte SUBSTRINGS_TYPE
        The BER type associated with the substrings filter type.
        See Also:
        Constant Field Values
      • GREATER_OR_EQUAL_TYPE

        public static final byte GREATER_OR_EQUAL_TYPE
        The BER type associated with the greaterOrEqual filter type.
        See Also:
        Constant Field Values
      • LESS_OR_EQUAL_TYPE

        public static final byte LESS_OR_EQUAL_TYPE
        The BER type associated with the lessOrEqual filter type.
        See Also:
        Constant Field Values
      • PRESENT_TYPE

        public static final byte PRESENT_TYPE
        The BER type associated with the present filter type.
        See Also:
        Constant Field Values
      • APPROXIMATE_MATCH_TYPE

        public static final byte APPROXIMATE_MATCH_TYPE
        The BER type associated with the approxMatch filter type.
        See Also:
        Constant Field Values
      • EXTENSIBLE_MATCH_TYPE

        public static final byte EXTENSIBLE_MATCH_TYPE
        The BER type associated with the extensibleMatch filter type.
        See Also:
        Constant Field Values
    • Method Detail

      • createEqualityFilter

        public static MatchedValuesFilter createEqualityFilter​(String rawAttributeType,
                                                               ByteString rawAssertionValue)
        Creates a new equalityMatch filter with the provided information.
        Parameters:
        rawAttributeType - The raw, unprocessed attribute type.
        rawAssertionValue - The raw, unprocessed assertion value.
        Returns:
        The created equalityMatch filter.
      • createEqualityFilter

        public static MatchedValuesFilter createEqualityFilter​(AttributeType attributeType,
                                                               ByteString assertionValue)
        Creates a new equalityMatch filter with the provided information.
        Parameters:
        attributeType - The attribute type.
        assertionValue - The assertion value.
        Returns:
        The created equalityMatch filter.
      • createSubstringsFilter

        public static MatchedValuesFilter createSubstringsFilter​(String rawAttributeType,
                                                                 ByteString subInitial,
                                                                 List<ByteString> subAny,
                                                                 ByteString subFinal)
        Creates a new substrings filter with the provided information.
        Parameters:
        rawAttributeType - The raw, unprocessed attribute type.
        subInitial - The subInitial element.
        subAny - The set of subAny elements.
        subFinal - The subFinal element.
        Returns:
        The created substrings filter.
      • createSubstringsFilter

        public static MatchedValuesFilter createSubstringsFilter​(AttributeType attributeType,
                                                                 ByteString subInitial,
                                                                 List<ByteString> subAny,
                                                                 ByteString subFinal)
        Creates a new substrings filter with the provided information.
        Parameters:
        attributeType - The raw, unprocessed attribute type.
        subInitial - The subInitial element.
        subAny - The set of subAny elements.
        subFinal - The subFinal element.
        Returns:
        The created substrings filter.
      • createGreaterOrEqualFilter

        public static MatchedValuesFilter createGreaterOrEqualFilter​(String rawAttributeType,
                                                                     ByteString rawAssertionValue)
        Creates a new greaterOrEqual filter with the provided information.
        Parameters:
        rawAttributeType - The raw, unprocessed attribute type.
        rawAssertionValue - The raw, unprocessed assertion value.
        Returns:
        The created greaterOrEqual filter.
      • createGreaterOrEqualFilter

        public static MatchedValuesFilter createGreaterOrEqualFilter​(AttributeType attributeType,
                                                                     ByteString assertionValue)
        Creates a new greaterOrEqual filter with the provided information.
        Parameters:
        attributeType - The attribute type.
        assertionValue - The assertion value.
        Returns:
        The created greaterOrEqual filter.
      • createLessOrEqualFilter

        public static MatchedValuesFilter createLessOrEqualFilter​(String rawAttributeType,
                                                                  ByteString rawAssertionValue)
        Creates a new lessOrEqual filter with the provided information.
        Parameters:
        rawAttributeType - The raw, unprocessed attribute type.
        rawAssertionValue - The raw, unprocessed assertion value.
        Returns:
        The created lessOrEqual filter.
      • createLessOrEqualFilter

        public static MatchedValuesFilter createLessOrEqualFilter​(AttributeType attributeType,
                                                                  ByteString assertionValue)
        Creates a new lessOrEqual filter with the provided information.
        Parameters:
        attributeType - The attribute type.
        assertionValue - The assertion value.
        Returns:
        The created lessOrEqual filter.
      • createPresentFilter

        public static MatchedValuesFilter createPresentFilter​(String rawAttributeType)
        Creates a new present filter with the provided information.
        Parameters:
        rawAttributeType - The raw, unprocessed attribute type.
        Returns:
        The created present filter.
      • createPresentFilter

        public static MatchedValuesFilter createPresentFilter​(AttributeType attributeType)
        Creates a new present filter with the provided information.
        Parameters:
        attributeType - The attribute type.
        Returns:
        The created present filter.
      • createApproximateFilter

        public static MatchedValuesFilter createApproximateFilter​(String rawAttributeType,
                                                                  ByteString rawAssertionValue)
        Creates a new approxMatch filter with the provided information.
        Parameters:
        rawAttributeType - The raw, unprocessed attribute type.
        rawAssertionValue - The raw, unprocessed assertion value.
        Returns:
        The created approxMatch filter.
      • createApproximateFilter

        public static MatchedValuesFilter createApproximateFilter​(AttributeType attributeType,
                                                                  ByteString assertionValue)
        Creates a new approxMatch filter with the provided information.
        Parameters:
        attributeType - The attribute type.
        assertionValue - The assertion value.
        Returns:
        The created approxMatch filter.
      • createExtensibleMatchFilter

        public static MatchedValuesFilter createExtensibleMatchFilter​(String rawAttributeType,
                                                                      String matchingRuleID,
                                                                      ByteString rawAssertionValue)
        Creates a new extensibleMatch filter with the provided information.
        Parameters:
        rawAttributeType - The raw, unprocessed attribute type.
        matchingRuleID - The matching rule ID.
        rawAssertionValue - The raw, unprocessed assertion value.
        Returns:
        The created extensibleMatch filter.
      • createExtensibleMatchFilter

        public static MatchedValuesFilter createExtensibleMatchFilter​(AttributeType attributeType,
                                                                      MatchingRule matchingRule,
                                                                      ByteString assertionValue)
        Creates a new extensibleMatch filter with the provided information.
        Parameters:
        attributeType - The attribute type.
        matchingRule - The matching rule.
        assertionValue - The assertion value.
        Returns:
        The created extensibleMatch filter.
      • createFromLDAPFilter

        public static MatchedValuesFilter createFromLDAPFilter​(RawFilter filter)
                                                        throws LDAPException
        Creates a new matched values filter from the provided LDAP filter.
        Parameters:
        filter - The LDAP filter to use for this matched values filter.
        Returns:
        The corresponding matched values filter.
        Throws:
        LDAPException - If the provided LDAP filter cannot be treated as a matched values filter.
      • encode

        public void encode​(ASN1Writer writer)
                    throws IOException
        Encodes this matched values filter as an ASN.1 element.
        Parameters:
        writer - The ASN1Writer to use to encode this matched values filter.
        Throws:
        IOException - if an error occurs while encoding.
      • decode

        public static MatchedValuesFilter decode​(ASN1Reader reader)
                                          throws LDAPException
        Decodes the provided ASN.1 element as a matched values filter item.
        Parameters:
        reader - The ASN.1 reader.
        Returns:
        The decoded matched values filter.
        Throws:
        LDAPException - If a problem occurs while attempting to decode the filter item.
      • getMatchType

        public byte getMatchType()
        Retrieves the match type for this matched values filter.
        Returns:
        The match type for this matched values filter.
      • getRawAttributeType

        public String getRawAttributeType()
        Retrieves the raw, unprocessed attribute type for this matched values filter.
        Returns:
        The raw, unprocessed attribute type for this matched values filter, or null if there is none.
      • getAttributeType

        public AttributeType getAttributeType()
        Retrieves the attribute type for this matched values filter.
        Returns:
        The attribute type for this matched values filter, or null if there is none.
      • getRawAssertionValue

        public ByteString getRawAssertionValue()
        Retrieves the raw, unprocessed assertion value for this matched values filter.
        Returns:
        The raw, unprocessed assertion value for this matched values filter, or null if there is none.
      • getAssertionValue

        public ByteString getAssertionValue()
        Retrieves the assertion value for this matched values filter.
        Returns:
        The assertion value for this matched values filter, or null if there is none.
      • getSubInitialElement

        public ByteString getSubInitialElement()
        Retrieves the subInitial element for this matched values filter.
        Returns:
        The subInitial element for this matched values filter, or null if there is none.
      • getSubAnyElements

        public List<ByteString> getSubAnyElements()
        Retrieves the set of subAny elements for this matched values filter.
        Returns:
        The set of subAny elements for this matched values filter. If there are none, then the return value may be either null or an empty list.
      • getSubFinalElement

        public ByteString getSubFinalElement()
        Retrieves the subFinal element for this matched values filter.
        Returns:
        The subFinal element for this matched values filter, or null if there is none.
      • getMatchingRuleID

        public String getMatchingRuleID()
        Retrieves the matching rule ID for this matched values filter.
        Returns:
        The matching rule ID for this matched values filter, or null if there is none.
      • getMatchingRule

        public MatchingRule getMatchingRule()
        Retrieves the matching rule for this matched values filter.
        Returns:
        The matching rule for this matched values filter, or null if there is none.
      • getApproximateMatchingRule

        public MatchingRule getApproximateMatchingRule()
        Retrieves the approximate matching rule that should be used for this matched values filter.
        Returns:
        The approximate matching rule that should be used for this matched values filter, or null if there is none.
      • getEqualityMatchingRule

        public MatchingRule getEqualityMatchingRule()
        Retrieves the equality matching rule that should be used for this matched values filter.
        Returns:
        The equality matching rule that should be used for this matched values filter, or null if there is none.
      • getOrderingMatchingRule

        public MatchingRule getOrderingMatchingRule()
        Retrieves the ordering matching rule that should be used for this matched values filter.
        Returns:
        The ordering matching rule that should be used for this matched values filter, or null if there is none.
      • getSubstringMatchingRule

        public MatchingRule getSubstringMatchingRule()
        Retrieves the substring matching rule that should be used for this matched values filter.
        Returns:
        The substring matching rule that should be used for this matched values filter, or null if there is none.
      • valueMatches

        public boolean valueMatches​(AttributeType type,
                                    ByteString value)
        Indicates whether the specified attribute value matches the criteria defined in this matched values filter.
        Parameters:
        type - The attribute type with which the provided value is associated.
        value - The attribute value for which to make the determination.
        Returns:
        true if the specified attribute value matches the criteria defined in this matched values filter, or false if not.
      • toString

        public String toString()
        Retrieves a string representation of this matched values filter, as an RFC 2254-compliant filter string.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this matched values filter.
      • toString

        public void toString​(StringBuilder buffer)
        Appends a string representation of this matched values filter, as an RFC 2254-compliant filter string, to the provided buffer.
        Parameters:
        buffer - The buffer to which the filter string should be appended.