Constructor and Description |
---|
RDN(Attribute... attrs)
Constructs a new object based on a list of Attributes.
|
RDN(AttributeType attrType,
java.lang.String value)
Constructs an RDN based on a single attribute value.
|
RDN(java.lang.String rdnStr)
Constructs an RDN from LDAP formatted string.
|
Modifier and Type | Method and Description |
---|---|
protected void |
clearAttributeList(int cnt)
Method called by native library to empty the Attribute list,
and insert a number of null place-holders
|
boolean |
equals(java.lang.Object anObject)
Compare this RDN to the specified object, and return true if the argument
is a RDN that represents the same value as this object.
|
protected void |
finalize()
Releases any native structures associated with this object.
|
Attribute |
getAttribute(int pos)
Returns an attribute from the RDN.
|
int |
getAttributeCount()
Returns the number of attributes.
|
int |
hashCode()
Overrides Object.hashCode in order to be consistent with
the equals(Object) method.
|
boolean |
isSameValue(RDN value)
Test whether this value is equivalent to another.
|
java.util.Iterator<Attribute> |
iterator()
Iterate through all the Attributes in this RDN.
|
protected void |
jni_dispose()
Native function used to clean up any C data structures attached
to this object when it is destroyed in finalisation.
|
java.lang.String |
toOIDString()
Generate a String representation of the RDN, including dotted OID
values instead of attribute names.
|
java.lang.String |
toString()
Returns a String representation of the RDN, containing its attribute
name(s) and value(s).
|
java.lang.String |
toUIString()
Return a friendly string representation of the RDN (in other words, one
that contains no attribute type names).
|
public RDN(java.lang.String rdnStr) throws BadDNException
rdnStr
- String representation of RDN (not null
).BadDNException
- in case of invalid RDN.NativeLibraryException
- if an unrecoverable error was detected
by the native librarypublic RDN(Attribute... attrs) throws BadDNException
attrs
- list of Attributes (not null
)BadDNException
- in case of invalid RDN, or if attrs is null.NativeLibraryException
- if an unrecoverable error was detected
by the native librarypublic RDN(AttributeType attrType, java.lang.String value) throws BadDNException, BadSyntaxException, BadValueException
AttributeType snType = new AttributeType("sn"); RDN rdn = new RDN(snType, "Smith");will create an RDN for "sn=Smith"
attrType
- an AttributeType (not null
)value
- attribute value string (not null
)BadDNException
- in case of invalid RDN.BadSyntaxException
- if the syntax of value is not valid
for this attribute.BadValueException
- if value is not a valid LDAP string
representation of an attrType.NativeLibraryException
- if an unrecoverable error was detected
by the native library.protected void jni_dispose() throws NativeLibraryException
NativeLibraryException
- if an unrecoverable error was detected
by the native libraryprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
protected void clearAttributeList(int cnt)
public int getAttributeCount()
public Attribute getAttribute(int pos)
pos
- Position in (unordered) list of RDNs.null
).java.lang.ArrayIndexOutOfBoundsException
- if pos out of range.public java.util.Iterator<Attribute> iterator()
iterator
in interface java.lang.Iterable<Attribute>
public boolean isSameValue(RDN value) throws NativeLibraryException, java.lang.NullPointerException
value
- Value to compare against (not null
)NativeLibraryException
- if an unrecoverable error was detected
by the native libraryjava.lang.NullPointerException
public final java.lang.String toUIString()
Thus an RDN of "cn=Mister Magoo" gives "Mister Magoo".
Multiple values are separated by non-delimited plus signs, for example "sales+J. Smith". Unlike the toString() method, no escaping of special characters within the values takes place; so an RDN representing the common name "harry, fred, ginger + marty" will be returned as "harry, fred, ginger + marty".
null
)toString()
public final java.lang.String toString() throws NativeLibraryException
toString
in class java.lang.Object
null
)NativeLibraryException
- if an unrecoverable error was detected
by the native libraryRDN(String)
,
toUIString()
,
toOIDString()
public boolean equals(java.lang.Object anObject)
equals
in class java.lang.Object
anObject
- an object to compare this RDN against
(null
allowed - will return false
)true
if the values are equal,
false
otherwise.NativeLibraryException
- if an unrecoverable error was detected
by the native librarypublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toOIDString()
String values returned by this method may be used when constructing new RDNs, in which case they are considered equivalent to their "non OID" forms.
For example
RDN rdn = new RDN("cn=Mister Magoo"); String str = rdn.toString(); String oid = rdn.toOIDString(); System.out.println(str); System.out.println(oid); RDN rdn2 = new RDN(oid); System.out.println(rdn.equals(rdn2));will display
cn=Mister Magoo 2.5.4.3=Mister Magoo true
toString()
,
toUIString()
,
DN.toOIDString()
Version: 16.6v6-0
Copyright (c) 2008-2018 Isode