|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--netscape.ldap.LDAPCompareAttrNames
Compares LDAP entries based on one or more attribute values.
To use this comparison for sorting search results, pass
an object of this class to the sort
method in
LDAPSearchResults
.
LDAPEntryComparator
,
LDAPSearchResults.sort(netscape.ldap.LDAPEntryComparator)
Constructor Summary | |
LDAPCompareAttrNames(java.lang.String attribute)
Constructs a comparator that compares the string values of a named attribute in LDAP entries and sorts the entries in ascending order. |
|
LDAPCompareAttrNames(java.lang.String[] attributes)
Constructs a comparator that compares the string values of a set of named attributes in LDAP entries and that sort the entries in ascending order. |
|
LDAPCompareAttrNames(java.lang.String[] attributes,
boolean[] ascendingFlags)
Constructs a comparator that compares the string values of a set of named attributes in LDAP entries and allows you to sort the entries in ascending or descending order. |
|
LDAPCompareAttrNames(java.lang.String attribute,
boolean ascendingFlag)
Constructs a comparator that compares the string values of a named attribute in LDAP entries and that allows you to sort entries either in ascending or descending order. |
Method Summary | |
java.util.Locale |
getLocale()
Gets the locale, if any, used for collation. |
boolean |
isGreater(LDAPEntry greater,
LDAPEntry less)
Returns true if the value of the attribute in the first entry is greater
than the value of the attribute in the second entry. |
void |
setLocale(java.util.Locale locale)
Set the locale, if any, used for collation. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public LDAPCompareAttrNames(java.lang.String attribute)
attribute
- name of attribute for comparisonspublic LDAPCompareAttrNames(java.lang.String attribute, boolean ascendingFlag)
attribute
- name of attribute for comparisonsascendingFlag
- if true
, sort in ascending orderpublic LDAPCompareAttrNames(java.lang.String[] attributes)
Use an array of strings to specify the set of attributes
to use for sorting. If the values of the first attribute
(the name specified in attribute[0]
) are equal,
then the values of the next attribute are compared.
For example, if attributes[0] = "cn"
and
attributes[1]="uid"
, results are first sorted
by the cn
attribute. If two entries have the
same value for cn
, then the uid
attribute is used to sort the entries.
attributes
- array of the attribute names used for comparisonspublic LDAPCompareAttrNames(java.lang.String[] attributes, boolean[] ascendingFlags)
Use an array of strings to specify the set of attributes
to use for sorting. If the values of the first attribute
(the name specified in attribute[0]
)
are equal, then the values of the next attribute are compared.
For example, if attributes[0] = "cn"
and
attributes[1]="uid"
, results are first sorted
by the cn
attribute. If two entries have the
same value for cn
, then the uid
attribute is used to sort the entries.
Use an array of boolean values to specify whether each attribute
should be sorted in ascending or descending order. For example,
suppose that attributes[0] = "cn"
and
attributes[1]="roomNumber"
. If
ascendingFlags[0]=true
and
ascendingFlags[1]=false
, attributes are sorted first by
cn
in ascending order, then by roomNumber
in descending order.
If the size of the array of attribute names is not the same as
the size of the array of boolean values, an
LDAPException
is thrown.
attribute
- array of the attribute names to use for comparisonsascendingFlags
- array of boolean values specifying ascending
or descending order to use for each attribute name. If
true
, the attributes are sorted in ascending order.Method Detail |
public java.util.Locale getLocale()
public void setLocale(java.util.Locale locale)
locale
- the locale used for collation, or null.public boolean isGreater(LDAPEntry greater, LDAPEntry less)
true
if the value of the attribute in the first entry is greater
than the value of the attribute in the second entry.
If one of the entries is missing the attribute, the other is considered greater. By default, the first entry is greater.
If either entry contains multiple values, only the first value is used for comparisons.
greater
- entry against which to testless
- entry to testtrue
if (greater > less
).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |