Package org.ldaptive.dn
Class Dn
java.lang.Object
org.ldaptive.dn.Dn
Distinguished name containing zero or more relative distinguished names. RDNs are ordered from left to right such
that the left-most RDN is considered the first. For the DN 'cn=Jane Doe,ou=People,dc=ldaptive,dc=org', the first RDN
is 'cn=Jane Doe'.
See RFC 4514 for more details on the string representations of
DNs.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
hash code seed.RDN components. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the supplied RDN at the supplied index.void
Adds all the RDNs in the supplied DN to the end of this DN.void
Adds the supplied RDN to the end of this DN.static Dn.Builder
builder()
Creates a builder for this class.boolean
format()
Produces a string representation of this DN.format
(RDnNormalizer normalizer) Produces a string representation of this DN.getRDn()
Returns the first RDN in this DN.getRDns()
Returns the RDNs in this DN.Returns the first RDN value with the supplied name.Returns the RDN values with the supplied name.int
hashCode()
int
size()
Returns the number of RDNs in this DN.subDn
(int index) Returns a new DN containing all the RDN components from the supplied index.subDn
(int beginIndex, int endIndex) Returns a new DN containing all the RDN components between the supplied indexes.toString()
-
Field Details
-
HASH_CODE_SEED
private static final int HASH_CODE_SEEDhash code seed.- See Also:
-
rdnComponents
RDN components.
-
-
Constructor Details
-
Dn
public Dn()Default constructor. -
Dn
Creates a new DN with the supplied string.- Parameters:
dn
- to parse
-
Dn
Creates a new DN with the supplied string.- Parameters:
dn
- to parseparser
- to parse dn
-
Dn
Creates a new DN with the supplied RDNs.- Parameters:
rdn
- to add
-
Dn
Creates a new DN with the supplied RDNs.- Parameters:
rdns
- to add
-
-
Method Details
-
getRDn
Returns the first RDN in this DN.- Returns:
- first RDN
-
getRDns
Returns the RDNs in this DN.- Returns:
- RDNs
-
add
Adds all the RDNs in the supplied DN to the end of this DN.- Parameters:
dn
- to add to this DN
-
add
Adds the supplied RDN to the end of this DN.- Parameters:
rdn
- to add to this DN
-
add
Adds the supplied RDN at the supplied index.- Parameters:
index
- to add the RDN atrdn
- to add to this DN
-
subDn
Returns a new DN containing all the RDN components from the supplied index.- Parameters:
index
- of RDNs to include- Returns:
- DN with sub-components of this DN
-
subDn
Returns a new DN containing all the RDN components between the supplied indexes.- Parameters:
beginIndex
- first RDN to include (inclusive)endIndex
- last RDN to include (exclusive)- Returns:
- DN with sub-components of this DN
-
getValues
Returns the RDN values with the supplied name. If the RDN is multi-value the first value is used.- Parameters:
name
- of the RDN- Returns:
- RDN value
-
getValue
Returns the first RDN value with the supplied name. If the RDN is multi-value the first value is used.- Parameters:
name
- of the RDN- Returns:
- RDN value
-
size
public int size()Returns the number of RDNs in this DN.- Returns:
- number of RDNs
-
format
Produces a string representation of this DN.- Returns:
- DN string
-
format
Produces a string representation of this DN.- Parameters:
normalizer
- to apply to the RDN components or null for no formatting- Returns:
- DN string
-
equals
-
hashCode
public int hashCode() -
toString
-
builder
Creates a builder for this class.- Returns:
- new builder
-