@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class RDN extends java.lang.Object implements java.lang.Comparable<RDN>, java.util.Comparator<RDN>, java.io.Serializable
DN
class for more information about DNs and
RDNs.Constructor and Description |
---|
RDN(java.lang.String rdnString)
Creates a new RDN from the provided string representation.
|
RDN(java.lang.String[] attributeNames,
byte[][] attributeValues)
Creates a new (potentially multivalued) RDN.
|
RDN(java.lang.String[] attributeNames,
byte[][] attributeValues,
Schema schema)
Creates a new (potentially multivalued) RDN.
|
RDN(java.lang.String[] attributeNames,
java.lang.String[] attributeValues)
Creates a new (potentially multivalued) RDN.
|
RDN(java.lang.String[] attributeNames,
java.lang.String[] attributeValues,
Schema schema)
Creates a new (potentially multivalued) RDN.
|
RDN(java.lang.String attributeName,
byte[] attributeValue)
Creates a new single-valued RDN with the provided information.
|
RDN(java.lang.String attributeName,
byte[] attributeValue,
Schema schema)
Creates a new single-valued RDN with the provided information.
|
RDN(java.lang.String rdnString,
Schema schema)
Creates a new RDN from the provided string representation.
|
RDN(java.lang.String attributeName,
java.lang.String attributeValue)
Creates a new single-valued RDN with the provided information.
|
RDN(java.lang.String attributeName,
java.lang.String attributeValue,
Schema schema)
Creates a new single-valued RDN with the provided information.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(RDN rdn1,
RDN rdn2)
Compares the provided RDN values to determine their relative order in a
sorted list.
|
static int |
compare(java.lang.String s1,
java.lang.String s2)
Compares the RDN values with the provided string representations to
determine their relative order in a sorted list.
|
static int |
compare(java.lang.String s1,
java.lang.String s2,
Schema schema)
Compares the RDN values with the provided string representations to
determine their relative order in a sorted list.
|
int |
compareTo(RDN rdn)
Compares the provided RDN to this RDN to determine their relative order in
a sorted list.
|
boolean |
equals(java.lang.Object o)
Indicates whether this RDN is equal to the provided object.
|
boolean |
equals(java.lang.String s)
Indicates whether the RDN with the provided string representation is equal
to this RDN.
|
static boolean |
equals(java.lang.String s1,
java.lang.String s2)
Indicates whether the two provided strings represent the same RDN.
|
java.lang.String[] |
getAttributeNames()
Retrieves the set of attribute names for this RDN.
|
Attribute[] |
getAttributes()
Retrieves an array of the attributes that comprise this RDN.
|
java.lang.String[] |
getAttributeValues()
Retrieves the set of attribute values for this RDN.
|
byte[][] |
getByteArrayAttributeValues()
Retrieves the set of attribute values for this RDN.
|
boolean |
hasAttribute(java.lang.String attributeName)
Indicates whether this RDN contains the specified attribute.
|
boolean |
hasAttributeValue(java.lang.String attributeName,
byte[] attributeValue)
Indicates whether this RDN contains the specified attribute value.
|
boolean |
hasAttributeValue(java.lang.String attributeName,
java.lang.String attributeValue)
Indicates whether this RDN contains the specified attribute value.
|
int |
hashCode()
Retrieves a hash code for this RDN.
|
boolean |
isMultiValued()
Indicates whether this RDN contains multiple components.
|
static boolean |
isValidRDN(java.lang.String s)
Indicates whether the provided string represents a valid RDN.
|
static java.lang.String |
normalize(java.lang.String s)
Retrieves a normalized string representation of the RDN with the provided
string representation.
|
static java.lang.String |
normalize(java.lang.String s,
Schema schema)
Retrieves a normalized string representation of the RDN with the provided
string representation.
|
java.lang.String |
toMinimallyEncodedString()
Retrieves a string representation of this RDN with minimal encoding for
special characters.
|
java.lang.String |
toNormalizedString()
Retrieves a normalized string representation of this RDN.
|
void |
toNormalizedString(java.lang.StringBuilder buffer)
Appends a normalized string representation of this RDN to the provided
buffer.
|
java.lang.String |
toString()
Retrieves a string representation of this RDN.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this RDN to the provided buffer.
|
void |
toString(java.lang.StringBuilder buffer,
boolean minimizeEncoding)
Appends a string representation of this RDN to the provided buffer.
|
public RDN(java.lang.String attributeName, java.lang.String attributeValue)
attributeName
- The attribute name for this RDN. It must not be
null
.attributeValue
- The attribute value for this RDN. It must not be
null
.public RDN(java.lang.String attributeName, java.lang.String attributeValue, Schema schema)
attributeName
- The attribute name for this RDN. It must not be
null
.attributeValue
- The attribute value for this RDN. It must not be
null
.schema
- The schema to use to generate the normalized string
representation of this RDN. It may be null
if no schema is available.public RDN(java.lang.String attributeName, byte[] attributeValue)
attributeName
- The attribute name for this RDN. It must not be
null
.attributeValue
- The attribute value for this RDN. It must not be
null
.public RDN(java.lang.String attributeName, byte[] attributeValue, Schema schema)
attributeName
- The attribute name for this RDN. It must not be
null
.attributeValue
- The attribute value for this RDN. It must not be
null
.schema
- The schema to use to generate the normalized string
representation of this RDN. It may be null
if no schema is available.public RDN(java.lang.String[] attributeNames, java.lang.String[] attributeValues)
attributeNames
- The set of attribute names for this RDN. It must
not be null
or empty.attributeValues
- The set of attribute values for this RDN. It must
not be null
or empty.public RDN(java.lang.String[] attributeNames, java.lang.String[] attributeValues, Schema schema)
attributeNames
- The set of attribute names for this RDN. It must
not be null
or empty.attributeValues
- The set of attribute values for this RDN. It must
not be null
or empty.schema
- The schema to use to generate the normalized
string representation of this RDN. It may be
null
if no schema is available.public RDN(java.lang.String[] attributeNames, byte[][] attributeValues)
attributeNames
- The set of attribute names for this RDN. It must
not be null
or empty.attributeValues
- The set of attribute values for this RDN. It must
not be null
or empty.public RDN(java.lang.String[] attributeNames, byte[][] attributeValues, Schema schema)
attributeNames
- The set of attribute names for this RDN. It must
not be null
or empty.attributeValues
- The set of attribute values for this RDN. It must
not be null
or empty.schema
- The schema to use to generate the normalized
string representation of this RDN. It may be
null
if no schema is available.public RDN(java.lang.String rdnString) throws LDAPException
rdnString
- The string representation to use for this RDN. It must
not be empty or null
.LDAPException
- If the provided string cannot be parsed as a valid
RDN.public RDN(java.lang.String rdnString, Schema schema) throws LDAPException
rdnString
- The string representation to use for this RDN. It must
not be empty or null
.schema
- The schema to use to generate the normalized string
representation of this RDN. It may be null
if
no schema is available.LDAPException
- If the provided string cannot be parsed as a valid
RDN.public static boolean isValidRDN(java.lang.String s)
s
- The string for which to make the determination. It must not be
null
.true
if the provided string represents a valid RDN, or
false
if not.public boolean isMultiValued()
true
if this RDN contains multiple components, or
false
if not.public Attribute[] getAttributes()
public java.lang.String[] getAttributeNames()
public java.lang.String[] getAttributeValues()
public byte[][] getByteArrayAttributeValues()
public boolean hasAttribute(java.lang.String attributeName)
attributeName
- The name of the attribute for which to make the
determination.true
if RDN contains the specified attribute, or
false
if not.public boolean hasAttributeValue(java.lang.String attributeName, java.lang.String attributeValue)
attributeName
- The name of the attribute for which to make the
determination.attributeValue
- The attribute value for which to make the
determination.true
if RDN contains the specified attribute, or
false
if not.public boolean hasAttributeValue(java.lang.String attributeName, byte[] attributeValue)
attributeName
- The name of the attribute for which to make the
determination.attributeValue
- The attribute value for which to make the
determination.true
if RDN contains the specified attribute, or
false
if not.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toMinimallyEncodedString()
public void toString(java.lang.StringBuilder buffer)
buffer
- The buffer to which the string representation is to be
appended.public void toString(java.lang.StringBuilder buffer, boolean minimizeEncoding)
buffer
- The buffer to which the string representation is
to be appended.minimizeEncoding
- Indicates whether to restrict the encoding of
special characters to the bare minimum required
by LDAP (as per RFC 4514 section 2.4). If this
is true
, then only leading and trailing
spaces, double quotes, plus signs, commas,
semicolons, greater-than, less-than, and
backslash characters will be encoded.public java.lang.String toNormalizedString()
public void toNormalizedString(java.lang.StringBuilder buffer)
buffer
- The buffer to which the normalized string representation is
to be appended.public static java.lang.String normalize(java.lang.String s) throws LDAPException
s
- The string representation of the RDN to normalize. It must not
be null
.LDAPException
- If the provided string cannot be parsed as an RDN.public static java.lang.String normalize(java.lang.String s, Schema schema) throws LDAPException
s
- The string representation of the RDN to normalize. It must
not be null
.schema
- The schema to use to generate the normalized string
representation of the RDN. It may be null
if no
schema is available.LDAPException
- If the provided string cannot be parsed as an RDN.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in interface java.util.Comparator<RDN>
equals
in class java.lang.Object
o
- The object for which to make the determination.true
if the provided object can be considered equal to
this RDN, or false
if not.public boolean equals(java.lang.String s) throws LDAPException
s
- The string representation of the DN to compare with this RDN.true
if the DN with the provided string representation is
equal to this RDN, or false
if not.LDAPException
- If the provided string cannot be parsed as an RDN.public static boolean equals(java.lang.String s1, java.lang.String s2) throws LDAPException
s1
- The string representation of the first RDN for which to make
the determination. It must not be null
.s2
- The string representation of the second RDN for which to make
the determination. It must not be null
.true
if the provided strings represent the same RDN, or
false
if not.LDAPException
- If either of the provided strings cannot be parsed
as an RDN.public int compareTo(RDN rdn)
compareTo
in interface java.lang.Comparable<RDN>
rdn
- The RDN to compare against this RDN. It must not be
null
.public int compare(RDN rdn1, RDN rdn2)
compare
in interface java.util.Comparator<RDN>
rdn1
- The first RDN to be compared. It must not be null
.rdn2
- The second RDN to be compared. It must not be null
.public static int compare(java.lang.String s1, java.lang.String s2) throws LDAPException
s1
- The string representation of the first RDN to be compared. It
must not be null
.s2
- The string representation of the second RDN to be compared. It
must not be null
.LDAPException
- If either of the provided strings cannot be parsed
as an RDN.public static int compare(java.lang.String s1, java.lang.String s2, Schema schema) throws LDAPException
s1
- The string representation of the first RDN to be compared.
It must not be null
.s2
- The string representation of the second RDN to be compared.
It must not be null
.schema
- The schema to use to generate the normalized string
representations of the RDNs. It may be null
if no
schema is available.LDAPException
- If either of the provided strings cannot be parsed
as an RDN.