com.unboundid.ldap.sdk.controls
Class SortKey

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

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

This class provides a data structure for representing a sort key that is to be used in conjunction with the ServerSideSortRequestControl for requesting that the server sort the results before returning them to the client.

A sort key includes the following elements:

See Also:
Serialized Form

Constructor Summary
SortKey(java.lang.String attributeName)
          Creates a new sort key with the specified attribute name.
SortKey(java.lang.String attributeName, boolean reverseOrder)
          Creates a new sort key with the specified attribute name.
SortKey(java.lang.String attributeName, java.lang.String matchingRuleID, boolean reverseOrder)
          Creates a new sort key with the provided information.
 
Method Summary
static SortKey decode(ASN1Element element)
          Decodes the provided ASN.1 element as a sort key.
 java.lang.String getAttributeName()
          Retrieves the attribute name for this sort key.
 java.lang.String getMatchingRuleID()
          Retrieves the name or OID of the ordering matching rule that should be used to perform the sort, if defined.
 boolean reverseOrder()
          Indicates whether the sort should be performed in reverse order.
 java.lang.String toString()
          Retrieves a string representation of this sort key.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this sort key to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortKey

public SortKey(java.lang.String attributeName)
Creates a new sort key with the specified attribute name. It will use the default ordering matching rule associated with that attribute, and it will not use reverse order.

Parameters:
attributeName - The attribute name for this sort key. It must not be null.

SortKey

public SortKey(java.lang.String attributeName,
               boolean reverseOrder)
Creates a new sort key with the specified attribute name. It will use the default ordering matching rule associated with that attribute.

Parameters:
attributeName - The attribute name for this sort key. It must not be null.
reverseOrder - Indicates whether the sort should be performed in reverse order.

SortKey

public SortKey(java.lang.String attributeName,
               java.lang.String matchingRuleID,
               boolean reverseOrder)
Creates a new sort key with the provided information.

Parameters:
attributeName - The attribute name for this sort key. It must not be null.
matchingRuleID - The name or OID of the ordering matching rule that should be used to perform the sort. It may be null if the default ordering matching rule for the specified attribute is to be used.
reverseOrder - Indicates whether the sort should be performed in reverse order.
Method Detail

getAttributeName

public java.lang.String getAttributeName()
Retrieves the attribute name for this sort key.

Returns:
The attribute name for this sort key.

getMatchingRuleID

public java.lang.String getMatchingRuleID()
Retrieves the name or OID of the ordering matching rule that should be used to perform the sort, if defined.

Returns:
The name or OID of the ordering matching rule that should be used to perform the sort, or null if the sort should use the default ordering matching rule associated with the specified attribute.

reverseOrder

public boolean reverseOrder()
Indicates whether the sort should be performed in reverse order.

Returns:
true if the sort should be performed in reverse order, or false if it should be performed in the standard order for the associated ordering matching rule.

decode

public static SortKey decode(ASN1Element element)
                      throws LDAPException
Decodes the provided ASN.1 element as a sort key.

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

toString

public java.lang.String toString()
Retrieves a string representation of this sort key.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this sort key.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this sort key to the provided buffer.

Parameters:
buffer - The buffer to which to append a string representation of this sort key.