Package com.unboundid.ldap.sdk.controls
Class SortKey
java.lang.Object
com.unboundid.ldap.sdk.controls.SortKey
- All Implemented Interfaces:
Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class SortKey
extends Object
implements Serializable
This class provides a data structure for representing a sort key that is to
be used in conjunction with the
A sort key includes the following elements:
ServerSideSortRequestControl for
requesting that the server sort the results before returning them to the
client.
A sort key includes the following elements:
- The name of the attribute for which sorting is to be performed.
- A
reverseOrderflag that indicates whether the results should be sorted in ascending order (if the value isfalse) or descending order (if the value istrue). - An optional matching rule ID, which specifies the ordering matching rule that should be used to perform the sorting. If this is not provided, then the default ordering matching rule for the specified attribute will be used.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new sort key with the specified attribute name.Creates a new sort key with the specified attribute name.Creates a new sort key with the provided information. -
Method Summary
Modifier and TypeMethodDescriptionstatic SortKeydecode(ASN1Element element) Decodes the provided ASN.1 element as a sort key.Retrieves the attribute name for this sort key.Retrieves the name or OID of the ordering matching rule that should be used to perform the sort, if defined.booleanIndicates whether the sort should be performed in reverse order.toString()Retrieves a string representation of this sort key.voidtoString(StringBuilder buffer) Appends a string representation of this sort key to the provided buffer.
-
Constructor Details
-
SortKey
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 benull.
-
SortKey
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 benull.reverseOrder- Indicates whether the sort should be performed in reverse order.
-
SortKey
public SortKey(@NotNull String attributeName, @Nullable 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 benull.matchingRuleID- The name or OID of the ordering matching rule that should be used to perform the sort. It may benullif 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 Details
-
getAttributeName
Retrieves the attribute name for this sort key.- Returns:
- The attribute name for this sort key.
-
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
nullif the sort should use the default ordering matching rule associated with the specified attribute.
-
reverseOrder
Indicates whether the sort should be performed in reverse order.- Returns:
trueif the sort should be performed in reverse order, orfalseif it should be performed in the standard order for the associated ordering matching rule.
-
decode
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
Retrieves a string representation of this sort key. -
toString
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.
-