Package org.ldaptive.dn
Class RDn
- java.lang.Object
-
- org.ldaptive.dn.RDn
-
public class RDn extends Object
Relative distinguished name containing one or more name value pairs. Name value pairs are ordered from left to right such that the left-most pair is considered the first. For the RDN 'cn=Jane Doe+mail=jdoe@example.com', the first name value pair is 'cn=Jane Doe'. See RFC 4514 for more details on the string representations of RDNs.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
HASH_CODE_SEED
hash code seed.private Set<NameValue>
nameValues
Name value pairs.
-
Constructor Summary
Constructors Constructor Description RDn(String rdn)
Creates a new RDN with the supplied string.RDn(String attributeName, String attributeValue)
Creates a new RDN with a single name value pair.RDn(String rdn, DnParser parser)
Creates a new RDN with the supplied string.RDn(Collection<NameValue> values)
Creates a new RDN with the supplied name value pairs.RDn(NameValue... value)
Creates a new RDN with the supplied name value pairs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
format()
Returns a string representation of this RDN.String
format(RDnNormalizer normalizer)
Returns a string representation of this RDN, joining each name value pair with '+'.List<String>
getNames()
Returns all the names in this RDN.NameValue
getNameValue()
Returns the first name value pair in this RDN.NameValue
getNameValue(String name)
Returns a single name value that matches the supplied name.Set<NameValue>
getNameValues()
Returns all the name value pairs in this RDN.Set<NameValue>
getNameValues(String name)
Returns the name values that match the supplied name.int
hashCode()
boolean
isEmpty()
Returns whether this RDN contains any name values.boolean
isSame(RDn rdn)
Returns whether the normalized format of the supplied RDN equals the normalized format of this RDN.boolean
isSame(RDn rdn, RDnNormalizer normalizer)
Returns whether the normalized format of the supplied RDN equals the normalized format of this RDN.int
size()
Returns the number of name value pairs in this RDN.String
toString()
-
-
-
Field Detail
-
HASH_CODE_SEED
private static final int HASH_CODE_SEED
hash code seed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RDn
public RDn(String rdn)
Creates a new RDN with the supplied string.- Parameters:
rdn
- to parse- Throws:
IllegalArgumentException
- if rdn contains multiple RDNs or no RDNs
-
RDn
public RDn(String rdn, DnParser parser)
Creates a new RDN with the supplied string.- Parameters:
rdn
- to parseparser
- to parse dn- Throws:
IllegalArgumentException
- if rdn contains multiple RDNs or no RDNS
-
RDn
public RDn(NameValue... value)
Creates a new RDN with the supplied name value pairs.- Parameters:
value
- to add
-
RDn
public RDn(Collection<NameValue> values)
Creates a new RDN with the supplied name value pairs.- Parameters:
values
- to add
-
-
Method Detail
-
getNameValue
public NameValue getNameValue()
Returns the first name value pair in this RDN.- Returns:
- name value pair
-
getNameValues
public Set<NameValue> getNameValues()
Returns all the name value pairs in this RDN.- Returns:
- name value paris
-
getNameValues
public Set<NameValue> getNameValues(String name)
Returns the name values that match the supplied name.- Parameters:
name
- to match- Returns:
- name values
-
getNameValue
public NameValue getNameValue(String name)
Returns a single name value that matches the supplied name. SeegetNameValues(String)
.- Parameters:
name
- to match- Returns:
- name value
-
size
public int size()
Returns the number of name value pairs in this RDN.- Returns:
- RDN size
-
isEmpty
public boolean isEmpty()
Returns whether this RDN contains any name values.- Returns:
- whether this RDN contains any name values
-
isSame
public boolean isSame(RDn rdn)
Returns whether the normalized format of the supplied RDN equals the normalized format of this RDN. SeeDefaultRDnNormalizer
.- Parameters:
rdn
- to compare- Returns:
- whether the supplied RDN is the same as this RDN
-
isSame
public boolean isSame(RDn rdn, RDnNormalizer normalizer)
Returns whether the normalized format of the supplied RDN equals the normalized format of this RDN.- Parameters:
normalizer
- to use for comparisonrdn
- to compare- Returns:
- whether the supplied RDN is the same as this RDN
-
format
public String format()
Returns a string representation of this RDN. Uses aDefaultRDnNormalizer
by default.- Returns:
- string form of the RDN
-
format
public String format(RDnNormalizer normalizer)
Returns a string representation of this RDN, joining each name value pair with '+'.- Parameters:
normalizer
- to apply to the RDN components or null for no formatting- Returns:
- string form of the RDN
-
-