@PublicAPI(stability=UNCOMMITTED, mayInstantiate=true, mayExtend=false, mayInvoke=true) public final class DN extends Object implements Comparable<DN>, Serializable
Modifier and Type | Field and Description |
---|---|
static byte |
NORMALIZED_AVA_SEPARATOR
AVA separator for normalized byte string of a DN.
|
static byte |
NORMALIZED_ESC_BYTE
Escape byte for normalized byte string of a DN.
|
static byte |
NORMALIZED_RDN_SEPARATOR
RDN separator for normalized byte string of a DN.
|
static DN |
NULL_DN
A singleton instance of the null DN (a DN with no components).
|
Constructor and Description |
---|
DN()
Creates a new DN with no RDN components (i.e., a null DN or root
DSE).
|
DN(List<RDN> rdnComponents)
Creates a new DN with the provided set of RDNs, arranged with the
suffix as the last element.
|
DN(RDN[] rdnComponents)
Creates a new DN with the provided set of RDNs, arranged with the
suffix as the last element.
|
DN(RDN rdn,
DN parentDN)
Creates a new DN with the given RDN below the specified parent.
|
Modifier and Type | Method and Description |
---|---|
DN |
child(DN relativeBaseDN)
Creates a new DN that is a descendant of this DN, using the
specified DN as a relative base DN.
|
DN |
child(RDN rdn)
Creates a new DN that is a child of this DN, using the specified
RDN.
|
int |
compareTo(DN other)
Compares this DN with the provided DN based on a natural order, as defined by
the toNormalizedByteString() method.
|
DN |
concat(RDN[] rdnComponents)
Creates a new DN that is a descendant of this DN, using the
specified RDN components.
|
static DN |
decode(org.forgerock.opendj.ldap.ByteSequence dnString)
Decodes the provided ASN.1 octet string as a DN.
|
boolean |
equals(Object o)
Indicates whether the provided object is equal to this DN.
|
DN |
getParentDNInSuffix()
Retrieves the DN of the entry that is the immediate parent for
this entry.
|
RDN |
getRDN(int pos)
Retrieves the RDN component at the specified position in the set
of components for this DN.
|
int |
hashCode()
Returns the hash code for this DN.
|
boolean |
isAncestorOf(DN dn)
Indicates whether this DN is an ancestor of the provided DN
(i.e., that the RDN components of this DN are the same as the
last RDN components for the provided DN).
|
boolean |
isDescendantOf(DN dn)
Indicates whether this DN is a descendant of the provided DN
(i.e., that the RDN components of the provided DN are the
same as the last RDN components for this DN).
|
boolean |
isRootDN()
Indicates whether this represents a null DN.
|
boolean |
matchesBaseAndScope(DN baseDN,
org.forgerock.opendj.ldap.SearchScope scope)
Indicates whether this entry falls within the range of the
provided search base DN and scope.
|
DN |
parent()
Retrieves the DN of the entry that is the immediate parent for
this entry.
|
RDN |
rdn()
Retrieves the outermost RDN component for this DN (i.e., the one
that is furthest from the suffix).
|
DN |
rename(DN fromDN,
DN toDN)
Returns a copy of this DN whose parent DN,
fromDN , has been renamed
to the new parent DN, toDN . |
static DN |
rootDN()
Retrieves a singleton instance of the null DN.
|
int |
size()
Retrieves the number of RDN components for this DN.
|
org.forgerock.opendj.ldap.ByteString |
toNormalizedByteString()
Retrieves a normalized byte string representation of this DN.
|
String |
toNormalizedUrlSafeString()
Retrieves a normalized string representation of this DN.
|
String |
toString()
Retrieves a string representation of this DN.
|
void |
toString(StringBuilder buffer)
Appends a string representation of this DN to the provided
buffer.
|
static DN |
valueOf(String dnString)
Decodes the provided string as a DN.
|
public static final DN NULL_DN
public static final byte NORMALIZED_RDN_SEPARATOR
public static final byte NORMALIZED_AVA_SEPARATOR
public static final byte NORMALIZED_ESC_BYTE
public DN()
public DN(RDN[] rdnComponents)
rdnComponents
- The set of RDN components that make up
this DN.public DN(List<RDN> rdnComponents)
rdnComponents
- The set of RDN components that make up
this DN.public static DN rootDN()
public boolean isRootDN()
true
if this does represent a null DN, or
false
if it does not.public int size()
public RDN rdn()
null
if there are no RDN components in the
DN.public DN rename(DN fromDN, DN toDN)
fromDN
, has been renamed
to the new parent DN, toDN
. If this DN is not subordinate or equal
to fromDN
then this DN is returned (i.e. the DN is not renamed).fromDN
- The old parent DN.toDN
- The new parent DN.public RDN getRDN(int pos)
pos
- The position of the RDN component to retrieve.public DN parent()
null
if the entry with this
DN does not have a parent.public DN getParentDNInSuffix()
null
if the entry with this
DN does not have a parent (either because there is only
a single RDN component or because this DN is a suffix
defined in the server).public DN child(RDN rdn)
rdn
- The RDN for the child of this DN.public DN concat(RDN[] rdnComponents)
rdnComponents
- The RDN components for the descendant of
this DN.public DN child(DN relativeBaseDN)
relativeBaseDN
- The relative base DN to concatenate onto
this DN.public boolean isDescendantOf(DN dn)
dn
- The DN for which to make the determination.true
if this DN is a descendant of the
provided DN, or false
if not.public boolean isAncestorOf(DN dn)
dn
- The DN for which to make the determination.true
if this DN is an ancestor of the
provided DN, or false
if not.public boolean matchesBaseAndScope(DN baseDN, org.forgerock.opendj.ldap.SearchScope scope)
baseDN
- The base DN for which to make the determination.scope
- The search scope for which to make the
determination.true
if this entry is within the given
base and scope, or false
if it is not.public static DN decode(org.forgerock.opendj.ldap.ByteSequence dnString) throws DirectoryException
dnString
- The ASN.1 octet string to decode as a DN.DirectoryException
- If a problem occurs while trying to
decode the provided ASN.1 octet
string as a DN.public static DN valueOf(String dnString) throws DirectoryException
dnString
- The string to decode as a DN.DirectoryException
- If a problem occurs while trying to
decode the provided string as a DN.public boolean equals(Object o)
public int hashCode()
public void toString(StringBuilder buffer)
buffer
- The buffer to which the information should be
appended.public String toNormalizedUrlSafeString()
This representation is safe to use in an URL or in a file name. However, it is not a valid DN and can't be reverted to a valid DN.
public org.forgerock.opendj.ldap.ByteString toNormalizedByteString()
This representation is suitable for equality and comparisons, and for providing a
natural hierarchical ordering.
However, it is not a valid DN and can't be reverted to a valid DN.
You should consider using a CompactDn
as an alternative.
public int compareTo(DN other)
compareTo
in interface Comparable<DN>
other
- The DN against which to compare this DN.Copyright © 2010-2015 ForgeRock AS. All Rights Reserved.