com.unboundid.ldap.sdk.controls
Class MatchedValuesFilter

java.lang.Object
  extended by com.unboundid.ldap.sdk.controls.MatchedValuesFilter
All Implemented Interfaces:
java.io.Serializable

@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class MatchedValuesFilter
extends java.lang.Object
implements java.io.Serializable

This class provides an implementation of the simple filter item for use with the MatchedValuesRequestControl as defined in RFC 3876. It is similar to a search filter (see the Filter class), but may only contain a single element (i.e., no AND, OR, or NOT components are allowed), and extensible matching does not allow the use of the dnAttributes field.

See Also:
Serialized Form

Field Summary
static byte MATCH_TYPE_APPROXIMATE
          The match type that will be used for approximate match filters.
static byte MATCH_TYPE_EQUALITY
          The match type that will be used for equality match filters.
static byte MATCH_TYPE_EXTENSIBLE
          The match type that will be used for extensible match filters.
static byte MATCH_TYPE_GREATER_OR_EQUAL
          The match type that will be used for greater-or-equal match filters.
static byte MATCH_TYPE_LESS_OR_EQUAL
          The match type that will be used for less-or-equal match filters.
static byte MATCH_TYPE_PRESENT
          The match type that will be used for presence match filters.
static byte MATCH_TYPE_SUBSTRINGS
          The match type that will be used for substring match filters.
 
Method Summary
static MatchedValuesFilter create(Filter filter)
          Creates a new matched values filter from the provided search filter, if possible.
static MatchedValuesFilter createApproximateFilter(java.lang.String attributeType, byte[] assertionValue)
          Creates a new matched values filter for approximate matching with the provided information.
static MatchedValuesFilter createApproximateFilter(java.lang.String attributeType, java.lang.String assertionValue)
          Creates a new matched values filter for approximate matching with the provided information.
static MatchedValuesFilter createEqualityFilter(java.lang.String attributeType, byte[] assertionValue)
          Creates a new matched values filter for equality matching with the provided information.
static MatchedValuesFilter createEqualityFilter(java.lang.String attributeType, java.lang.String assertionValue)
          Creates a new matched values filter for equality matching with the provided information.
static MatchedValuesFilter createExtensibleMatchFilter(java.lang.String attributeType, java.lang.String matchingRuleID, byte[] assertionValue)
          Creates a new matched values filter for extensible matching with the provided information.
static MatchedValuesFilter createExtensibleMatchFilter(java.lang.String attributeType, java.lang.String matchingRuleID, java.lang.String assertionValue)
          Creates a new matched values filter for extensible matching with the provided information.
static MatchedValuesFilter createGreaterOrEqualFilter(java.lang.String attributeType, byte[] assertionValue)
          Creates a new matched values filter for greater-or-equal matching with the provided information.
static MatchedValuesFilter createGreaterOrEqualFilter(java.lang.String attributeType, java.lang.String assertionValue)
          Creates a new matched values filter for greater-or-equal matching with the provided information.
static MatchedValuesFilter createLessOrEqualFilter(java.lang.String attributeType, byte[] assertionValue)
          Creates a new matched values filter for less-or-equal matching with the provided information.
static MatchedValuesFilter createLessOrEqualFilter(java.lang.String attributeType, java.lang.String assertionValue)
          Creates a new matched values filter for less-or-equal matching with the provided information.
static MatchedValuesFilter createPresentFilter(java.lang.String attributeType)
          Creates a new matched values filter for presence matching with the provided information.
static MatchedValuesFilter createSubstringFilter(java.lang.String attributeType, byte[] subInitialValue, byte[][] subAnyValues, byte[] subFinalValue)
          Creates a new matched values filter for substring matching with the provided information.
static MatchedValuesFilter createSubstringFilter(java.lang.String attributeType, java.lang.String subInitialValue, java.lang.String[] subAnyValues, java.lang.String subFinalValue)
          Creates a new matched values filter for substring matching with the provided information.
static MatchedValuesFilter decode(ASN1Element element)
          Decodes the provided ASN.1 element as a matched values filter.
 ASN1Element encode()
          Encodes this matched values filter for use in the matched values control.
 java.lang.String getAssertionValue()
          Retrieves the string representation of the assertion value for this matched values filter, if available.
 byte[] getAssertionValueBytes()
          Retrieves the binary representation of the assertion value for this matched values filter, if available.
 java.lang.String getAttributeType()
          Retrieves the name of the attribute type for this matched values filter, if available.
 java.lang.String getMatchingRuleID()
          Retrieves the matching rule ID for this matched values filter, if available.
 byte getMatchType()
          Retrieves the match type for this matched values filter.
 ASN1OctetString getRawAssertionValue()
          Retrieves raw assertion value for this matched values filter, if available.
 ASN1OctetString[] getRawSubAnyValues()
          Retrieves the raw subAny elements for this matched values filter, if available.
 ASN1OctetString getRawSubFinalValue()
          Retrieves the raw subFinal element for this matched values filter, if available.
 ASN1OctetString getRawSubInitialValue()
          Retrieves the raw subInitial element for this matched values filter, if available.
 byte[][] getSubAnyValueBytes()
          Retrieves the binary representations of the subAny elements for this matched values filter, if available.
 java.lang.String[] getSubAnyValues()
          Retrieves the string representations of the subAny elements for this matched values filter, if available.
 java.lang.String getSubFinalValue()
          Retrieves the string representation of the subFinal element for this matched values filter, if available.
 byte[] getSubFinalValueBytes()
          Retrieves the binary representation of the subFinal element for this matched values filter, if available.
 java.lang.String getSubInitialValue()
          Retrieves the string representation of the subInitial element for this matched values filter, if available.
 byte[] getSubInitialValueBytes()
          Retrieves the binary representation of the subInitial element for this matched values filter, if available.
 Filter toFilter()
          Creates a search filter that is the equivalent of this matched values filter.
 java.lang.String toString()
          Retrieves a string representation of this matched values filter.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this matched values filter to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MATCH_TYPE_EQUALITY

public static final byte MATCH_TYPE_EQUALITY
The match type that will be used for equality match filters.

See Also:
Constant Field Values

MATCH_TYPE_SUBSTRINGS

public static final byte MATCH_TYPE_SUBSTRINGS
The match type that will be used for substring match filters.

See Also:
Constant Field Values

MATCH_TYPE_GREATER_OR_EQUAL

public static final byte MATCH_TYPE_GREATER_OR_EQUAL
The match type that will be used for greater-or-equal match filters.

See Also:
Constant Field Values

MATCH_TYPE_LESS_OR_EQUAL

public static final byte MATCH_TYPE_LESS_OR_EQUAL
The match type that will be used for less-or-equal match filters.

See Also:
Constant Field Values

MATCH_TYPE_PRESENT

public static final byte MATCH_TYPE_PRESENT
The match type that will be used for presence match filters.

See Also:
Constant Field Values

MATCH_TYPE_APPROXIMATE

public static final byte MATCH_TYPE_APPROXIMATE
The match type that will be used for approximate match filters.

See Also:
Constant Field Values

MATCH_TYPE_EXTENSIBLE

public static final byte MATCH_TYPE_EXTENSIBLE
The match type that will be used for extensible match filters.

See Also:
Constant Field Values
Method Detail

createEqualityFilter

public static MatchedValuesFilter createEqualityFilter(java.lang.String attributeType,
                                                       java.lang.String assertionValue)
Creates a new matched values filter for equality matching with the provided information.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
assertionValue - The assertion value for the filter. It must not be null.
Returns:
The created equality match filter.

createEqualityFilter

public static MatchedValuesFilter createEqualityFilter(java.lang.String attributeType,
                                                       byte[] assertionValue)
Creates a new matched values filter for equality matching with the provided information.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
assertionValue - The assertion value for the filter. It must not be null.
Returns:
The created equality match filter.

createSubstringFilter

public static MatchedValuesFilter createSubstringFilter(java.lang.String attributeType,
                                                        java.lang.String subInitialValue,
                                                        java.lang.String[] subAnyValues,
                                                        java.lang.String subFinalValue)
Creates a new matched values filter for substring matching with the provided information. At least one substring filter element must be provided.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
subInitialValue - The subInitial value for the filter, or null if there is no subInitial element.
subAnyValues - The set of subAny values for the filter, or null if there are no subAny elements.
subFinalValue - The subFinal value for the filter, or null if there is no subFinal element.
Returns:
The created equality match filter.

createSubstringFilter

public static MatchedValuesFilter createSubstringFilter(java.lang.String attributeType,
                                                        byte[] subInitialValue,
                                                        byte[][] subAnyValues,
                                                        byte[] subFinalValue)
Creates a new matched values filter for substring matching with the provided information. At least one substring filter element must be provided.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
subInitialValue - The subInitial value for the filter, or null if there is no subInitial element.
subAnyValues - The set of subAny values for the filter, or null if there are no subAny elements.
subFinalValue - The subFinal value for the filter, or null if there is no subFinal element.
Returns:
The created equality match filter.

createGreaterOrEqualFilter

public static MatchedValuesFilter createGreaterOrEqualFilter(java.lang.String attributeType,
                                                             java.lang.String assertionValue)
Creates a new matched values filter for greater-or-equal matching with the provided information.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
assertionValue - The assertion value for the filter. It must not be null.
Returns:
The created greater-or-equal match filter.

createGreaterOrEqualFilter

public static MatchedValuesFilter createGreaterOrEqualFilter(java.lang.String attributeType,
                                                             byte[] assertionValue)
Creates a new matched values filter for greater-or-equal matching with the provided information.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
assertionValue - The assertion value for the filter. It must not be null.
Returns:
The created greater-or-equal match filter.

createLessOrEqualFilter

public static MatchedValuesFilter createLessOrEqualFilter(java.lang.String attributeType,
                                                          java.lang.String assertionValue)
Creates a new matched values filter for less-or-equal matching with the provided information.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
assertionValue - The assertion value for the filter. It must not be null.
Returns:
The created less-or-equal match filter.

createLessOrEqualFilter

public static MatchedValuesFilter createLessOrEqualFilter(java.lang.String attributeType,
                                                          byte[] assertionValue)
Creates a new matched values filter for less-or-equal matching with the provided information.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
assertionValue - The assertion value for the filter. It must not be null.
Returns:
The created less-or-equal match filter.

createPresentFilter

public static MatchedValuesFilter createPresentFilter(java.lang.String attributeType)
Creates a new matched values filter for presence matching with the provided information.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
Returns:
The created present match filter.

createApproximateFilter

public static MatchedValuesFilter createApproximateFilter(java.lang.String attributeType,
                                                          java.lang.String assertionValue)
Creates a new matched values filter for approximate matching with the provided information.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
assertionValue - The assertion value for the filter. It must not be null.
Returns:
The created approximate match filter.

createApproximateFilter

public static MatchedValuesFilter createApproximateFilter(java.lang.String attributeType,
                                                          byte[] assertionValue)
Creates a new matched values filter for approximate matching with the provided information.

Parameters:
attributeType - The attribute type for the filter. It must not be null.
assertionValue - The assertion value for the filter. It must not be null.
Returns:
The created greater-or-equal match filter.

createExtensibleMatchFilter

public static MatchedValuesFilter createExtensibleMatchFilter(java.lang.String attributeType,
                                                              java.lang.String matchingRuleID,
                                                              java.lang.String assertionValue)
Creates a new matched values filter for extensible matching with the provided information. At least one of the attribute type and matching rule ID must be provided.

Parameters:
attributeType - The attribute type for the filter, or null if there is no attribute type.
matchingRuleID - The matching rule ID for the filter, or null if there is no matching rule ID.
assertionValue - The assertion value for the filter. It must not be null.
Returns:
The created extensible match filter.

createExtensibleMatchFilter

public static MatchedValuesFilter createExtensibleMatchFilter(java.lang.String attributeType,
                                                              java.lang.String matchingRuleID,
                                                              byte[] assertionValue)
Creates a new matched values filter for extensible matching with the provided information. At least one of the attribute type and matching rule ID must be provided.

Parameters:
attributeType - The attribute type for the filter, or null if there is no attribute type.
matchingRuleID - The matching rule ID for the filter, or null if there is no matching rule ID.
assertionValue - The assertion value for the filter. It must not be null.
Returns:
The created extensible match filter.

create

public static MatchedValuesFilter create(Filter filter)
                                  throws LDAPException
Creates a new matched values filter from the provided search filter, if possible.

Parameters:
filter - The search filter to use to create this matched values filter.
Returns:
The search filter that corresponds to this matched values filter.
Throws:
LDAPException - If the provided search filter cannot be represented as a matched values filter.

getMatchType

public byte getMatchType()
Retrieves the match type for this matched values filter.

Returns:
The match type for this matched values filter.

getAttributeType

public java.lang.String getAttributeType()
Retrieves the name of the attribute type for this matched values filter, if available.

Returns:
The name of the attribute type for this matched values filter, or null if there is none.

getAssertionValue

public java.lang.String getAssertionValue()
Retrieves the string representation of the assertion value for this matched values filter, if available.

Returns:
The string representation of the assertion value for this matched values filter, or null if there is none.

getAssertionValueBytes

public byte[] getAssertionValueBytes()
Retrieves the binary representation of the assertion value for this matched values filter, if available.

Returns:
The binary representation of the assertion value for this matched values filter, or null if there is none.

getRawAssertionValue

public ASN1OctetString getRawAssertionValue()
Retrieves raw assertion value for this matched values filter, if available.

Returns:
The raw assertion value for this matched values filter, or null if there is none.

getSubInitialValue

public java.lang.String getSubInitialValue()
Retrieves the string representation of the subInitial element for this matched values filter, if available.

Returns:
The string representation of the subInitial element for this matched values filter, or null if there is none.

getSubInitialValueBytes

public byte[] getSubInitialValueBytes()
Retrieves the binary representation of the subInitial element for this matched values filter, if available.

Returns:
The binary representation of the subInitial element for this matched values filter, or null if there is none.

getRawSubInitialValue

public ASN1OctetString getRawSubInitialValue()
Retrieves the raw subInitial element for this matched values filter, if available.

Returns:
The raw subInitial element for this matched values filter, or null if there is none.

getSubAnyValues

public java.lang.String[] getSubAnyValues()
Retrieves the string representations of the subAny elements for this matched values filter, if available.

Returns:
The string representations of the subAny element for this matched values filter, or an empty array if there are none.

getSubAnyValueBytes

public byte[][] getSubAnyValueBytes()
Retrieves the binary representations of the subAny elements for this matched values filter, if available.

Returns:
The binary representations of the subAny element for this matched values filter, or an empty array if there are none.

getRawSubAnyValues

public ASN1OctetString[] getRawSubAnyValues()
Retrieves the raw subAny elements for this matched values filter, if available.

Returns:
The raw subAny element for this matched values filter, or an empty array if there are none.

getSubFinalValue

public java.lang.String getSubFinalValue()
Retrieves the string representation of the subFinal element for this matched values filter, if available.

Returns:
The string representation of the subFinal element for this matched values filter, or null if there is none.

getSubFinalValueBytes

public byte[] getSubFinalValueBytes()
Retrieves the binary representation of the subFinal element for this matched values filter, if available.

Returns:
The binary representation of the subFinal element for this matched values filter, or null if there is none.

getRawSubFinalValue

public ASN1OctetString getRawSubFinalValue()
Retrieves the raw subFinal element for this matched values filter, if available.

Returns:
The raw subFinal element for this matched values filter, or null if there is none.

getMatchingRuleID

public java.lang.String getMatchingRuleID()
Retrieves the matching rule ID for this matched values filter, if available.

Returns:
The matching rule ID for this matched values filter, or null if there is none.

encode

public ASN1Element encode()
Encodes this matched values filter for use in the matched values control.

Returns:
The ASN.1 element containing the encoded representation of this matched values filter.

decode

public static MatchedValuesFilter decode(ASN1Element element)
                                  throws LDAPException
Decodes the provided ASN.1 element as a matched values filter.

Parameters:
element - The ASN.1 element to decode as a matched values filter.
Returns:
The decoded matched values filter.
Throws:
LDAPException - If the provided ASN.1 element cannot be decoded as a matched values filter.

toFilter

public Filter toFilter()
Creates a search filter that is the equivalent of this matched values filter.

Returns:
A search filter that is the equivalent of this matched values filter.

toString

public java.lang.String toString()
Retrieves a string representation of this matched values filter.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this matched values filter.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this matched values filter to the provided buffer.

Parameters:
buffer - The buffer to which to append the string representation of this matched values filter.