Package com.unboundid.ldap.sdk
Class RDNNameValuePair
- java.lang.Object
-
- com.unboundid.ldap.sdk.RDNNameValuePair
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<RDNNameValuePair>,java.util.Comparator<RDNNameValuePair>
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class RDNNameValuePair extends java.lang.Object implements java.lang.Comparable<RDNNameValuePair>, java.util.Comparator<RDNNameValuePair>, java.io.Serializable
This class provides a data structure that represents a single name-value pair that may appear in a relative distinguished name.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(RDNNameValuePair p1, RDNNameValuePair p2)Retrieves an integer value that represents the order in which the provided RDN name-value pairs should be placed in a sorted list.intcompareTo(RDNNameValuePair p)Retrieves an integer value that represents the order in which this RDN name-value pair should be placed in relation to the provided RDN name-value pair in a sorted list.booleanequals(java.lang.Object o)Indicates whether the provided object is considered logically equivalent to this RDN name-value pair.java.lang.StringgetAttributeName()Retrieves the attribute name for this name-value pair.java.lang.StringgetAttributeValue()Retrieves the string representation of the attribute value for this name-value pair.byte[]getAttributeValueBytes()Retrieves the bytes that comprise the attribute value for this name-value pair.java.lang.StringgetNormalizedAttributeName()Retrieves a normalized representation of the attribute name.ASN1OctetStringgetRawAttributeValue()Retrieves the raw attribute value for this name-value pair.booleanhasAttributeName(java.lang.String name)Indicates whether this RDN name-value pair has the provided attribute name (or a name that is logically equivalent to it).booleanhasAttributeValue(byte[] value)Indicates whether this RDN name-value pair has the provided attribute value (or a value that is logically equivalent to it).booleanhasAttributeValue(java.lang.String value)Indicates whether this RDN name-value pair has the provided attribute value (or a value that is logically equivalent to it).inthashCode()Retrieves a hash code for this RDN name-value pair.java.lang.StringtoMinimallyEncodedString()Retrieves a string representation of this RDN name-value pair with minimal encoding for special characters.java.lang.StringtoNormalizedString()Retrieves a normalized string representation of this RDN name-value pair.voidtoNormalizedString(java.lang.StringBuilder buffer)Appends a normalized string representation of this RDN name-value pair to the provided buffer.java.lang.StringtoString()Retrieves a string representation of this RDN name-value pair.voidtoString(java.lang.StringBuilder buffer, boolean minimizeEncoding)Appends a string representation of this RDN name-value pair to the provided buffer.
-
-
-
Method Detail
-
getAttributeName
public java.lang.String getAttributeName()
Retrieves the attribute name for this name-value pair.- Returns:
- The attribute name for this name-value pair.
-
getNormalizedAttributeName
public java.lang.String getNormalizedAttributeName()
Retrieves a normalized representation of the attribute name.- Returns:
- A normalized representation of the attribute name.
-
hasAttributeName
public boolean hasAttributeName(java.lang.String name)
Indicates whether this RDN name-value pair has the provided attribute name (or a name that is logically equivalent to it).- Parameters:
name- The name for which to make the determination.- Returns:
trueif this name-value pair has the provided attribute name (or a name that is logically equivalent to it), orfalseif not.
-
getAttributeValue
public java.lang.String getAttributeValue()
Retrieves the string representation of the attribute value for this name-value pair.- Returns:
- The string representation of the attribute value for this name-value pair.
-
getAttributeValueBytes
public byte[] getAttributeValueBytes()
Retrieves the bytes that comprise the attribute value for this name-value pair.- Returns:
- The bytes that comprise the attribute value for this name-value pair.
-
getRawAttributeValue
public ASN1OctetString getRawAttributeValue()
Retrieves the raw attribute value for this name-value pair.- Returns:
- The raw attribute value for this name-value pair.
-
hasAttributeValue
public boolean hasAttributeValue(java.lang.String value)
Indicates whether this RDN name-value pair has the provided attribute value (or a value that is logically equivalent to it).- Parameters:
value- The value for which to make the determination.- Returns:
trueif this RDN name-value pair has the provided attribute value (or a value that is logically equivalent to it), orfalseif not.
-
hasAttributeValue
public boolean hasAttributeValue(byte[] value)
Indicates whether this RDN name-value pair has the provided attribute value (or a value that is logically equivalent to it).- Parameters:
value- The value for which to make the determination.- Returns:
trueif this RDN name-value pair has the provided attribute value (or a value that is logically equivalent to it), orfalseif not.
-
compareTo
public int compareTo(RDNNameValuePair p)
Retrieves an integer value that represents the order in which this RDN name-value pair should be placed in relation to the provided RDN name-value pair in a sorted list.- Specified by:
compareToin interfacejava.lang.Comparable<RDNNameValuePair>- Parameters:
p- The RDN name-value pair to be ordered relative to this RDN name-value pair. It must not benull.- Returns:
- A negative integer if this RDN name-value pair should be ordered before the provided RDN name-value pair, a positive integer if this RDN name-value pair should be ordered after the provided RDN name-value pair, or zero if this RDN name-value pair is logically equivalent to the provided RDN name-value pair.
-
compare
public int compare(RDNNameValuePair p1, RDNNameValuePair p2)
Retrieves an integer value that represents the order in which the provided RDN name-value pairs should be placed in a sorted list.- Specified by:
comparein interfacejava.util.Comparator<RDNNameValuePair>- Parameters:
p1- The first RDN name-value pair to compare. It must not benull.p2- The second RDN name-value pair to compare. It must not benull.- Returns:
- A negative integer if the first RDN name-value pair should be ordered before the second RDN name-value pair, a positive integer if the first RDN name-value pair should be ordered after the second RDN name-value pair, or zero if the provided RDN name-value pairs are logically equivalent.
-
hashCode
public int hashCode()
Retrieves a hash code for this RDN name-value pair.- Overrides:
hashCodein classjava.lang.Object- Returns:
- A hash code for this RDN name-value pair.
-
equals
public boolean equals(java.lang.Object o)
Indicates whether the provided object is considered logically equivalent to this RDN name-value pair.- Specified by:
equalsin interfacejava.util.Comparator<RDNNameValuePair>- Overrides:
equalsin classjava.lang.Object- Parameters:
o- The object for which to make the determination.- Returns:
trueif the provided object is an RDN name-value pair that is logically equivalent to this RDN name-value pair, orfalseif not.
-
toString
public java.lang.String toString()
Retrieves a string representation of this RDN name-value pair.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of this RDN name-value pair.
-
toMinimallyEncodedString
public java.lang.String toMinimallyEncodedString()
Retrieves a string representation of this RDN name-value pair with minimal encoding for special characters. Only those characters specified in RFC 4514 section 2.4 will be escaped. No escaping will be used for non-ASCII characters or non-printable ASCII characters.- Returns:
- A string representation of this RDN name-value pair with minimal encoding for special characters.
-
toString
public void toString(java.lang.StringBuilder buffer, boolean minimizeEncoding)
Appends a string representation of this RDN name-value pair to the provided buffer.- Parameters:
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 istrue, then only leading and trailing spaces, double quotes, plus signs, commas, semicolons, greater-than, less-than, and backslash characters will be encoded.
-
toNormalizedString
public java.lang.String toNormalizedString()
Retrieves a normalized string representation of this RDN name-value pair.- Returns:
- A normalized string representation of this RDN name-value pair.
-
toNormalizedString
public void toNormalizedString(java.lang.StringBuilder buffer)
Appends a normalized string representation of this RDN name-value pair to the provided buffer.- Parameters:
buffer- The buffer to which the normalized string representation should be appended. It must not benull.
-
-