|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.ldap.LDAPComparator
public class LDAPComparator
Contains the functionality required for comparing LDAP objects.
This object is used for sorting LDAPEntry objects according to one or many of their attributes.
Sample code
String[] fields = new String[] {"cn","mail"};
LDAPComparator comp = new LDAPComparator ( fields );
String[] sortedFields = comp.getSortFields();
| Constructor Summary | ||
|---|---|---|
|
LDAPComparator(String[] sortAttributes)
Creates an LDAPComparator object given the list of sort attributes to use. |
|
| Method Summary | ||
|---|---|---|
|
int |
compare(Object o1,
Object o2)
Compares two LDAPEntry objects for order. |
|
boolean |
equals(Object o1)
Returns a boolean denoting whether the object passed into this method is equal to the current object. |
|
String[] |
getSortFields()
Returns the attributes used to compare objects. |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LDAPComparator(String[] sortAttributes)
LDAPComparator object given the list of sort attributes to use.
For example, to sort according to givenname followed by sn, use the following code:
LDAPComparator cmp = new LDAPComparator(new String[] {"givenname","sn"});
Note that all of the attributes provided should have values that are stored as String
objects. Any attributes whose values are stored as byte arrays will not be included in the comparison.
If passed an empty array of strings, all objects will be reported as equal.
sortFields - An array of Strings representing the sorting attributes. Must be non-null.| Method Detail |
|---|
public String[] getSortFields()
public int compare(Object o1,
Object o2)
LDAPEntry objects for order.
This method compares the values of the sort attributes provided when the LDAPComparator
was constructed. For each of those attributes, in order, the corresponding values are retrieved
and compared, in order. When differing values are encountered, the result of the lexicographic
comparison of those values is returned.
Note that any attributes whose values are stored as byte arrays will not be included in the comparison.
compare in interface Comparatoro1 - First LDAPEntry to compare.o2 - Second LDAPEntry to compare.
LDAPEntry is 'less than' the
second; a positive integer if the first LDAPEntry is 'greater than' the
second; zero if the two LDAPEntry objects are 'equal'.
ClassCastException - If both of the objects are not LDAPEntry objects.public boolean equals(Object o1)
equals in interface Comparatorequals in class Objecto1 - the reference object with which to compare.
true if this object is the same as the obj
argument; false otherwise.Boolean.hashCode(),
Hashtable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal