public final class RDN extends Object implements Iterable<AVA>, Comparable<RDN>
An entry's relative distinguished name must be unique among all immediate subordinates of the entry's immediate superior (i.e. all siblings).
The following are examples of string representations of RDNs:
uid=12345 ou=Engineering cn=Kurt Zeilenga+L=Redwood ShoresThe last is an example of a multi-valued RDN; that is, an RDN composed of multiple AVAs.
| Constructor and Description |
|---|
RDN(AttributeType attributeType,
Object attributeValue)
Creates a new RDN using the provided attribute type and value.
|
RDN(AVA... avas)
Creates a new RDN using the provided AVAs.
|
RDN(Collection<AVA> avas)
Creates a new RDN using the provided AVAs.
|
RDN(String attributeType,
Object attributeValue)
Creates a new RDN using the provided attribute type and value decoded
using the default schema.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(RDN rdn) |
boolean |
equals(Object obj) |
ByteString |
getAttributeValue(AttributeType attributeType)
Returns the attribute value contained in this RDN which is associated
with the provided attribute type, or
null if this RDN does not
include such an attribute value. |
AVA |
getFirstAVA()
Returns the first AVA contained in this RDN.
|
int |
hashCode() |
boolean |
isMultiValued()
Returns
true if this RDN contains more than one AVA. |
Iterator<AVA> |
iterator()
Returns an iterator of the AVAs contained in this RDN.
|
static RDN |
maxValue()
Returns a constant containing a special RDN which is greater than any
other RDN other than itself.
|
int |
size()
Returns the number of AVAs in this RDN.
|
String |
toString()
Returns the RFC 4514 string representation of this RDN.
|
static RDN |
valueOf(String rdn)
Parses the provided LDAP string representation of an RDN using the
default schema.
|
static RDN |
valueOf(String rdn,
Schema schema)
Parses the provided LDAP string representation of a RDN using the
provided schema.
|
public RDN(AttributeType attributeType, Object attributeValue)
If attributeValue is not an instance of ByteString then
it will be converted using the ByteString.valueOf(Object) method.
attributeType - The attribute type.attributeValue - The attribute value.NullPointerException - If attributeType or attributeValue was
null.public RDN(String attributeType, Object attributeValue)
If attributeValue is not an instance of ByteString then
it will be converted using the ByteString.valueOf(Object) method.
attributeType - The attribute type.attributeValue - The attribute value.UnknownSchemaElementException - If attributeType was not found in the default schema.NullPointerException - If attributeType or attributeValue was
null.public RDN(AVA... avas)
avas - The attribute-value assertions used to build this RDN.NullPointerException - If avas is null or contains a null ava.public RDN(Collection<AVA> avas)
avas - The attribute-value assertions used to build this RDN.NullPointerException - If ava is null or contains null ava.public static RDN maxValue()
SortedSets and
SortedMaps. For example, the following code can be used to
construct a range whose contents is a sub-tree of entries:
SortedMapentries = ...; DN baseDN = ...; // Returns a map containing the baseDN and all of its subordinates. SortedMap subtree = entries.subMap(baseDN, baseDN.child(RDN.maxValue));
public static RDN valueOf(String rdn)
rdn - The LDAP string representation of a RDN.LocalizedIllegalArgumentException - If rdn is not a valid LDAP string representation of a
RDN.NullPointerException - If rdn was null.public static RDN valueOf(String rdn, Schema schema)
rdn - The LDAP string representation of a RDN.schema - The schema to use when parsing the RDN.LocalizedIllegalArgumentException - If rdn is not a valid LDAP string representation of a
RDN.NullPointerException - If rdn or schema was null.public int compareTo(RDN rdn)
compareTo in interface Comparable<RDN>public ByteString getAttributeValue(AttributeType attributeType)
null if this RDN does not
include such an attribute value.attributeType - The attribute type.public AVA getFirstAVA()
public boolean isMultiValued()
true if this RDN contains more than one AVA.true if this RDN contains more than one AVA, otherwise
false.public Iterator<AVA> iterator()
Attempts to remove AVAs using an iterator's remove() method are
not permitted and will result in an UnsupportedOperationException
being thrown.
public int size()
public String toString()
toString in class ObjectCopyright © 2011-2015 ForgeRock AS. All Rights Reserved.