Package org.forgerock.opendj.ldap
Class Rdn
- java.lang.Object
- 
- org.forgerock.opendj.ldap.Rdn
 
- 
- All Implemented Interfaces:
- Comparable<Rdn>,- Iterable<Ava>
 
 public final class Rdn extends Object implements Iterable<Ava>, Comparable<Rdn> A relative distinguished name (RDN) as defined in RFC 4512 section 2.3 is the name of an entry relative to its immediate superior. An RDN is composed of an unordered set of one or more attribute value assertions (AVA) consisting of an attribute description with zero options and an attribute value. These AVAs are chosen to match attribute values (each a distinguished value) of the entry.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 Shores The last is an example of a multi-valued RDN; that is, an RDN composed of multiple AVAs.
- 
- 
Constructor SummaryConstructors Constructor Description Rdn(String attributeType, Object attributeValue)Creates a new RDN using the provided attribute type and value decoded using the default schema.Rdn(Collection<Ava> avas)Creates a new RDN using the provided AVAs.Rdn(Ava... avas)Creates a new RDN using the provided AVAs.Rdn(AttributeType attributeType, Object attributeValue)Creates a new RDN using the provided attribute type and value.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Rdn rdn)booleanequals(Object obj)ByteStringgetAttributeValue(AttributeType attributeType)Returns the attribute value contained in this RDN which is associated with the provided attribute type, ornullif this RDN does not include such an attribute value.AvagetFirstAva()Returns the first AVA contained in this RDN.booleanhasAttributeType(AttributeType attributeType)Indicates whether this RDN includes the specified attribute type.inthashCode()booleanisMultiValued()Returnstrueif this RDN contains more than one AVA.Iterator<Ava>iterator()Returns an iterator of the AVAs contained in this RDN.static RdnmaxValue()Returns a constant containing a special RDN which sorts after any RDN other than itself.static RdnminValue()Returns a constant containing a special RDN which sorts before any RDN other than itself.intsize()Returns the number of AVAs in this RDN.StringtoString()Returns the RFC 4514 string representation of this RDN.static RdnvalueOf(String rdn)Parses the provided LDAP string representation of an RDN using the default schema.static RdnvalueOf(String rdn, Schema schema)Parses the provided LDAP string representation of a RDN using the provided schema.- 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.lang.IterableforEach, spliterator
 
- 
 
- 
- 
- 
Constructor Detail- 
Rdnpublic Rdn(AttributeType attributeType, Object attributeValue) Creates a new RDN using the provided attribute type and value.If attributeValueis not an instance ofByteStringthen it will be converted using theByteString.valueOfObject(Object)method.- Parameters:
- attributeType- The attribute type.
- attributeValue- The attribute value.
- Throws:
- NullPointerException- If- attributeTypeor- attributeValuewas- null.
 
 - 
Rdnpublic Rdn(String attributeType, Object attributeValue) Creates a new RDN using the provided attribute type and value decoded using the default schema.If attributeValueis not an instance ofByteStringthen it will be converted using theByteString.valueOfObject(Object)method.- Parameters:
- attributeType- The attribute type.
- attributeValue- The attribute value.
- Throws:
- UnknownSchemaElementException- If- attributeTypewas not found in the default schema.
- NullPointerException- If- attributeTypeor- attributeValuewas- null.
 
 - 
Rdnpublic Rdn(Ava... avas) Creates a new RDN using the provided AVAs.- Parameters:
- avas- The attribute-value assertions used to build this RDN.
- Throws:
- NullPointerException- If- avasis- nullor contains a null ava.
- IllegalArgumentException- If- avasis empty.
 
 - 
Rdnpublic Rdn(Collection<Ava> avas) Creates a new RDN using the provided AVAs.- Parameters:
- avas- The attribute-value assertions used to build this RDN.
- Throws:
- NullPointerException- If- avais- nullor contains null ava.
- IllegalArgumentException- If- avasis empty.
 
 
- 
 - 
Method Detail- 
minValuepublic static Rdn minValue() Returns a constant containing a special RDN which sorts before any RDN other than itself. This RDN may be used in order to perform range queries on DN keyed collections such asSortedSets andSortedMaps. 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()));- Returns:
- A constant containing a special RDN which sorts before any RDN other than itself.
- See Also:
- maxValue()
 
 - 
maxValuepublic static Rdn maxValue() Returns a constant containing a special RDN which sorts after any RDN other than itself. This RDN may be used in order to perform range queries on DN keyed collections such asSortedSets andSortedMaps. 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()));- Returns:
- A constant containing a special RDN which sorts after any RDN other than itself.
- See Also:
- minValue()
 
 - 
valueOfpublic static Rdn valueOf(String rdn) Parses the provided LDAP string representation of an RDN using the default schema.- Parameters:
- rdn- The LDAP string representation of a RDN.
- Returns:
- The parsed RDN.
- Throws:
- LocalizedIllegalArgumentException- If- rdnis not a valid LDAP string representation of a RDN.
- NullPointerException- If- rdnwas- null.
 
 - 
valueOfpublic static Rdn valueOf(String rdn, Schema schema) Parses the provided LDAP string representation of a RDN using the provided schema.- Parameters:
- rdn- The LDAP string representation of a RDN.
- schema- The schema to use when parsing the RDN.
- Returns:
- The parsed RDN.
- Throws:
- LocalizedIllegalArgumentException- If- rdnis not a valid LDAP string representation of a RDN.
- NullPointerException- If- rdnor- schemawas- null.
 
 - 
compareTopublic int compareTo(Rdn rdn) - Specified by:
- compareToin interface- Comparable<Rdn>
 
 - 
getAttributeValuepublic ByteString getAttributeValue(AttributeType attributeType) Returns the attribute value contained in this RDN which is associated with the provided attribute type, ornullif this RDN does not include such an attribute value.- Parameters:
- attributeType- The attribute type.
- Returns:
- The attribute value.
 
 - 
getFirstAvapublic Ava getFirstAva() Returns the first AVA contained in this RDN.- Returns:
- The first AVA contained in this RDN.
 
 - 
isMultiValuedpublic boolean isMultiValued() Returnstrueif this RDN contains more than one AVA.- Returns:
- trueif this RDN contains more than one AVA, otherwise- false.
 
 - 
hasAttributeTypepublic boolean hasAttributeType(AttributeType attributeType) Indicates whether this RDN includes the specified attribute type.- Parameters:
- attributeType- The attribute type for which to make the determination.
- Returns:
- trueif the RDN includes the specified attribute type, or- falseif not.
 
 - 
iteratorpublic Iterator<Ava> iterator() Returns an iterator of the AVAs contained in this RDN. The AVAs will be returned in the user provided order.Attempts to remove AVAs using an iterator's remove()method are not permitted and will result in anUnsupportedOperationExceptionbeing thrown.
 - 
sizepublic int size() Returns the number of AVAs in this RDN.- Returns:
- The number of AVAs in this RDN.
 
 - 
toStringpublic String toString() Returns the RFC 4514 string representation of this RDN. If this RDN was constructed using a call tovalueOf(String), then this method will return the original user-provided string representation cleaned such that any illegal white-space characters are removed.- Overrides:
- toStringin class- Object
- Returns:
- The RFC 4514 string representation of this RDN.
- See Also:
- RFC 4514 - Lightweight Directory Access Protocol (LDAP): String Representation of Distinguished Names
 
 
- 
 
-