|
LDAP Classes Implements Java LDAP |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.novell.ldap.LDAPCompareAttrNames
Compares LDAP entries based on attribute name.
An object of this class defines ordering when sorting LDAPEntries, usually from search results. When using this Comparator, LDAPEntry objects are sorted by the attribute names(s) passed in on the constructor, in ascending or descending order. The object is typically supplied to an implementation of the collection interfaces such as java.util.TreeSet which performs sorting.
Comparison is performed via locale-sensitive Java String comparison, which may not correspond to the LDAP ordering rules by which an LDAP server would sort them.
Constructor Summary | |
LDAPCompareAttrNames(java.lang.String attrName)
Constructs an object that sorts results by a single attribute, in ascending order. |
|
LDAPCompareAttrNames(java.lang.String[] attrNames)
Constructs an object that sorts by one or more attributes, in the order provided, in ascending order. |
|
LDAPCompareAttrNames(java.lang.String[] attrNames,
boolean[] ascendingFlags)
Constructs an object that sorts by one or more attributes, in the order provided, in either ascending or descending order for each attribute. |
|
LDAPCompareAttrNames(java.lang.String attrName,
boolean ascendingFlag)
Constructs an object that sorts results by a single attribute, in either ascending or descending order. |
Method Summary | |
int |
compare(java.lang.Object object1,
java.lang.Object object2)
Compares the the attributes of the first LDAPEntry to the second. |
boolean |
equals(java.lang.Object comparator)
Determines if this comparator is equal to the comparator passed in. |
java.util.Locale |
getLocale()
Returns the locale to be used for sorting, if a locale has been specified. |
void |
setLocale(java.util.Locale locale)
Sets the locale to be used for sorting. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LDAPCompareAttrNames(java.lang.String attrName)
attrName
- Name of an attribute by which to sort.public LDAPCompareAttrNames(java.lang.String attrName, boolean ascendingFlag)
attrName
- Name of an attribute to sort by.
ascendingFlag
- True specifies ascending order; false specifies
descending order.public LDAPCompareAttrNames(java.lang.String[] attrNames)
Note: Novell eDirectory allows sorting by one attribute only. The direcctory server must also be configured to index the specified attribute.
attrNames
- Array of names of attributes to sort by.public LDAPCompareAttrNames(java.lang.String[] attrNames, boolean[] ascendingFlags) throws LDAPException
Note: Novell eDirectory supports only ascending sort order (A,B,C ...) and allows sorting only by one attribute. The directory server must be configured to index this attribute.
attrNames
- Array of names of attributes to sort by.
ascendingFlags
- Array of flags, one for each attrName, where
true specifies ascending order and false specifies
descending order. An LDAPException is thrown if
the length of ascendingFlags is not greater than
or equal to the length of attrNames.
LDAPException
- A general exception which includes an error
message and an LDAP error code.Method Detail |
public java.util.Locale getLocale()
If locale is null, a basic String.compareTo method is used for collation. If non-null, a locale-specific collation is used.
public void setLocale(java.util.Locale locale)
locale
- The locale to be used for sorting.public int compare(java.lang.Object object1, java.lang.Object object2)
Only the values of the attributes named at the construction of this object will be compared. Multi-valued attributes compare on the first value only.
compare
in interface java.util.Comparator
object1
- Target entry for comparison.object2
- Entry to be compared to.
public boolean equals(java.lang.Object comparator)
This will return true if the comparator is an instance of LDAPCompareAttrNames and compares the same attributes names in the same order.
equals
in interface java.util.Comparator
|
LDAP Classes Implements Java LDAP |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |