|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jndi.ldap.LdapName
public final class LdapName
LdapName implements compound names for LDAP v3 as
specified by RFC 2253.
RFC 2253 has a few ambiguities and outright inconsistencies. These are resolved as follows:
String names passed to LdapName or returned by it
use the full 16-bit Unicode character set. They may also contain
characters encoded into UTF-8 with each octet represented by a
three-character substring such as "\\B4".
They may not, however, contain characters encoded into UTF-8 with
each octet represented by a single character in the string: the
meaning would be ambiguous.
LdapName will properly parse all valid names, but
does not attempt to detect all possible violations when parsing
invalid names. It's "generous".
When names are tested for equality, attribute types and binary values are case-insensitive, and string values are by default case-insensitive. String values with different but equivalent usage of quoting, escaping, or UTF8-hex-encoding are considered equal. The order of components in multi-valued RDNs (such as "ou=Sales+cn=Bob") is not significant.
| Constructor Summary | |
|---|---|
LdapName(String name)
Constructs an LDAP name from the given DN. |
|
| Method Summary | |
|---|---|
Name |
add(int pos,
String comp)
Inserts the given String component to this Name
at the given index. |
Name |
add(String comp)
Adds the given String component to the end of this
Name. |
Name |
addAll(int pos,
Name suffix)
Inserts all the components of the given Name to this
Name at the given index. |
Name |
addAll(Name suffix)
Adds all the components of the given Name to the end of this
Name. |
Object |
clone()
clone creates a shallow clone of this. |
int |
compareTo(Object obj)
Compares the given object to this Name. |
boolean |
endsWith(Name n)
Returns true if this Name ends with the
components of the given Name, false otherwise. |
boolean |
equals(Object obj)
equals compares this object to another object. |
static String |
escapeAttributeValue(Object val)
Given the value of an attribute, returns a string suitable for inclusion in a DN. |
String |
get(int pos)
Gets the component at the given index. |
Enumeration |
getAll()
Returns a non-null (but possibly empty) Enumeration of the
components of the Name as Strings. |
Name |
getPrefix(int pos)
Returns the components till the given index as a Name. |
Name |
getSuffix(int pos)
Returns the components from the given index till the end as a Name. |
int |
hashCode()
hashCode returns a hash code for this object. |
boolean |
isEmpty()
Returns true if the number of components of this
Name is zero, false otherwise. |
Object |
remove(int pos)
Removes the component at the given index from this Name. |
void |
setValuesCaseSensitive(boolean caseSensitive)
Controls whether string-values are treated as case-sensitive when the string values within names are compared. |
int |
size()
Returns the number of components of this Name. |
boolean |
startsWith(Name n)
Returns true if this Name starts with the
components of the given Name, false otherwise. |
String |
toString()
toString creates a printable string that represents this object for debugging purposes. |
static Object |
unescapeAttributeValue(String val)
Given an attribute value formated according to RFC 2253, returns the unformated value. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LdapName(String name)
throws InvalidNameException
name - An LDAP DN. To JNDI, a compound name.
InvalidNameException - if a syntax violation is detected.| Method Detail |
|---|
public Object clone()
Object
clone in interface Nameclone in class Objectpublic String toString()
ObjectThe default implementation returns getClass().getName() + '@' + Integer.toHexString(hashCode()).
toString in class Objectpublic boolean equals(Object obj)
ObjectEquals must be symmetric (a.equals(b) == b.equals(a)), reflexive (a.equals(a)==true) and transitive (a.equals(b) && b.equals(c) IMPLIES (a.equals(c))) and not change over time (a.equals(b) == a.equals(b)). a.equals(null) should always return false.
If a.equals(b) is true for two objects a and b, then a.hashCode()==b.hashCode() must hold.
The default implementation of equals returns this==other.
equals in class Objectobj - the other object.
public int compareTo(Object obj)
NameName.
Returns a negative value if the given Object is smaller then
this Name, a positive value if the Object is
bigger, and zero if the are equal. If the Object is not of
a class that can be compared to the class of this Name then
a ClassCastException is thrown. Note that it is not
guaranteed that Names implemented in different classes can
be compared. The definition of smaller, bigger and equal is up to the
actual implementing class.
compareTo in interface ComparablecompareTo in interface Nameobj - the other object
public int hashCode()
ObjectThe default implementation returns System.identityHashCode(this).
hashCode in class Objectpublic int size()
NameName.
The returned number can be zero.
size in interface Namepublic boolean isEmpty()
Nametrue if the number of components of this
Name is zero, false otherwise.
isEmpty in interface Namepublic Enumeration getAll()
NameEnumeration of the
components of the Name as Strings.
getAll in interface Namepublic String get(int pos)
Name
get in interface Namepublic Name getPrefix(int pos)
NameName.
The returned Name can be modified without changing the
original.
getPrefix in interface Namepublic Name getSuffix(int pos)
NameName.
The returned Name can be modified without changing the
original.
getSuffix in interface Namepublic boolean startsWith(Name n)
Nametrue if this Name starts with the
components of the given Name, false otherwise.
startsWith in interface Namepublic boolean endsWith(Name n)
Nametrue if this Name ends with the
components of the given Name, false otherwise.
endsWith in interface Namepublic void setValuesCaseSensitive(boolean caseSensitive)
public Name addAll(Name suffix)
throws InvalidNameException
NameName to the end of this
Name. The method modifies the current Name and
then returns it.
addAll in interface NameInvalidNameException - if any of the given components is not a
valid component for this Name.
public Name addAll(int pos,
Name suffix)
throws InvalidNameException
NameName to this
Name at the given index. The method modifies the current
Name and then returns it.
addAll in interface NameInvalidNameException - if any of the given components is not a
valid component for this Name.
public Name add(String comp)
throws InvalidNameException
NameString component to the end of this
Name. The method modifies the current Name and
then returns it.
add in interface NameInvalidNameException - if the given String is not a
valid component for this Name.
public Name add(int pos,
String comp)
throws InvalidNameException
NameString component to this Name
at the given index. The method modifies the current Name and
then returns it.
add in interface NameInvalidNameException - if the given String is not a
valid component for this Name.
public Object remove(int pos)
throws InvalidNameException
NameName.
The method modifies the current Name and then returns it.
remove in interface NameInvalidNameException - if the given String is not a
valid component for this Name.public static String escapeAttributeValue(Object val)
, = + < > # ; " \
public static Object unescapeAttributeValue(String val)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||