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.
|
boolean |
hasAttributeType(AttributeType attributeType)
Indicates whether this RDN includes the specified attribute type.
|
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 sorts after any
RDN other than itself.
|
static Rdn |
minValue()
Returns a constant containing a special RDN which sorts before any
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.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public Rdn(AttributeType attributeType, Object attributeValue)
If attributeValue
is not an instance of ByteString
then
it will be converted using the ByteString.valueOfObject(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.valueOfObject(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.IllegalArgumentException
- If avas
is empty.public Rdn(Collection<Ava> avas)
avas
- The attribute-value assertions used to build this RDN.NullPointerException
- If ava
is null
or contains null ava.IllegalArgumentException
- If avas
is empty.public static Rdn minValue()
SortedSet
s and
SortedMap
s. For example, the following code can be used to
construct a range whose contents is a sub-tree of entries, excluding the base entry:
SortedMap<DN, Entry> entries = ...;
DN baseDN = ...;
// Returns a map containing the baseDN and all of its subordinates.
SortedMap<DN,Entry> subtree = entries.subMap(
baseDN.child(RDN.minValue()), baseDN.child(RDN.maxValue()));
maxValue()
public static Rdn maxValue()
SortedSet
s and
SortedMap
s. For example, the following code can be used to
construct a range whose contents is a sub-tree of entries:
SortedMap<DN, Entry> entries = ...;
DN baseDN = ...;
// Returns a map containing the baseDN and all of its subordinates.
SortedMap<DN,Entry> subtree = entries.subMap(baseDN, baseDN.child(RDN.maxValue()));
minValue()
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 boolean hasAttributeType(AttributeType attributeType)
attributeType
- The attribute type for which to make the determination.true
if the RDN includes the specified attribute type,
or false
if not.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 Object
Copyright 2010-2022 ForgeRock AS.