|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.5.0
javax.naming.ldap
|
Constructor Summary | |
---|---|
Rdn(Attributes attrSet)
Constructs an Rdn from the given attribute set. |
|
Rdn(Rdn rdn)
Constructs an Rdn from the given rdn. |
|
Rdn(String rdnString)
Constructs an Rdn from the given string. |
|
Rdn(String type,
Object value)
Constructs an Rdn from the given attribute type and value. |
Method Summary | |
---|---|
int |
compareTo(Object obj)
Compares this Rdn with the specified Object for order. |
boolean |
equals(Object obj)
Compares the specified Object with this Rdn for equality. |
static String |
escapeValue(Object val)
Given the value of an attribute, returns a string escaped according to the rules specified in RFC 2253. |
String |
getType()
Retrieves one of this Rdn's type. |
Object |
getValue()
Retrieves one of this Rdn's value. |
int |
hashCode()
Returns the hash code of this RDN. |
int |
size()
Retrieves the number of attribute type/value pairs in this Rdn. |
Attributes |
toAttributes()
Retrieves the Attributes
view of the type/value mappings contained in this Rdn. |
String |
toString()
Returns this Rdn as a string represented in a format defined by RFC 2253 and described in the class description for LdapName . |
static Object |
unescapeValue(String val)
Given an attribute value string formated according to the rules specified in RFC 2253, returns the unformated value. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Rdn(Attributes attrSet) throws InvalidNameException
Attributes
.
The string attribute values are not interpretted as RFC 2253 formatted RDN strings. That is, the values are used literally (not parsed) and assumed to be unescaped.
attrSet
- The non-null and non-empty attributes containing
type/value mappings.
InvalidNameException
- If contents of attrSet cannot
be used to construct a valid RDN.public Rdn(String rdnString) throws InvalidNameException
LdapName
.
rdnString
- The non-null and non-empty RFC2253 formatted string.
InvalidNameException
- If a syntax error occurs during
parsing of the rdnString.public Rdn(Rdn rdn)
rdn
- The non-null Rdn to be copied.public Rdn(String type, Object value) throws InvalidNameException
type
- The non-null and non-empty string attribute type.value
- The non-null and non-empty attribute value.
InvalidNameException
- If type/value cannot be used to
construct a valid RDN.toString()
Method Detail |
---|
public Object getValue()
For a multi-valued RDN, this method returns value corresponding
to the type returned by getType()
method.
public String getType()
For a multi-valued RDN, the type/value pairs have
no specific order defined on them. In that case, this method
returns type of one of the type/value pairs.
The getValue()
method returns the
value corresponding to the type returned by this method.
public String toString()
LdapName
.
public int compareTo(Object obj)
If obj is null or not an instance of Rdn, ClassCastException is thrown.
The attribute type and value pairs of the RDNs are lined up against each other and compared lexicographically. The order of components in multi-valued Rdns (such as "ou=Sales+cn=Bob") is not significant.
compareTo
in interface Comparable<Object>
obj
- The non-null object to compare against.
ClassCastException
- if obj is null or not a Rdn.
public boolean equals(Object obj)
Type and value equalilty matching is done as below:
If obj is null or not an instance of Rdn, false is returned.
obj
- object to be compared for equality with this Rdn.
hashCode()
public int hashCode()
equals(java.lang.Object)
public Attributes toAttributes()
Attributes
view of the type/value mappings contained in this Rdn.
public int size()
public static String escapeValue(Object val)
For example, if the val is "Sue, Grabbit and Runn", the escaped value returned by this method is "Sue\, Grabbit and Runn".
A string value is represented as a String and binary value as a byte array.
val
- The non-null object to be escaped.
ClassCastException
- if val is is not a String or byte array.public static Object unescapeValue(String val)
Legal and illegal values are defined in RFC 2253. This method is generous in accepting the values and does not catch all illegal values. Therefore, passing in an illegal value might not necessarily trigger an IllegalArgumentException.
val
- The non-null string to be unescaped.
IllegalArgumentException
- When an Illegal value
is provided.