org.springframework.ldap.support
Class LdapRdn

java.lang.Object
  extended byorg.springframework.ldap.support.LdapRdn

public class LdapRdn
extends java.lang.Object

Datatype for a LDAP name, a part of a path. The name: uid=adam.skogman Key: uid Value: adam.skogman

Author:
Adam Skogman

Field Summary
protected static java.util.regex.Pattern RDN_PATTERN
           
 
Constructor Summary
LdapRdn(java.lang.String ldapRdn)
          Constructs a RDN from an ldap encoded rdn "foo=bar".
LdapRdn(java.lang.String key, java.lang.String value)
          Constructs a RDN from a key and a value.
 
Method Summary
protected  java.lang.String encodeLdap()
          Encode key and value to ldap
 java.lang.Object encodeUrl()
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getKey()
           
 java.lang.String getLdapEncoded()
           
 java.lang.String getValue()
           
 int hashCode()
           
static LdapRdn parse(java.lang.String rdn)
          Parse the supplied String for a valid LdapRdn.
protected  void parseLdap(java.lang.String rdn)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RDN_PATTERN

protected static final java.util.regex.Pattern RDN_PATTERN
Constructor Detail

LdapRdn

public LdapRdn(java.lang.String ldapRdn)
        throws BadLdapGrammarException
Constructs a RDN from an ldap encoded rdn "foo=bar". The key will be forced to lowercase. The value is kept as is. The ldapEncoded value will not be the same, but rather a reencoded value, so that all looks the same.

Parameters:
ldapRdn -
Throws:
BadLdapGrammarException - If the rdn could not be parsed.

LdapRdn

public LdapRdn(java.lang.String key,
               java.lang.String value)
Constructs a RDN from a key and a value. The key will be forced to lowercase. The value is kept as is.

Parameters:
key - Not blank
value - Not blank
Method Detail

encodeLdap

protected java.lang.String encodeLdap()
Encode key and value to ldap

Returns:
The ldap encoded rdn

parseLdap

protected void parseLdap(java.lang.String rdn)
                  throws BadLdapGrammarException
Parameters:
rdn - The ldap rdn to parse
Throws:
BadLdapGrammarException - if any error occurs parsing the rdn.

parse

public static LdapRdn parse(java.lang.String rdn)
Parse the supplied String for a valid LdapRdn. Swallow any exceptions.

Parameters:
rdn - the String to parse.
Returns:
an LdapRdn corresponding to the supplied String if the format was valid, null otherwise.

getKey

public java.lang.String getKey()

getValue

public java.lang.String getValue()

toString

public java.lang.String toString()
See Also:
Object.toString()

equals

public boolean equals(java.lang.Object obj)
See Also:
Object.equals(java.lang.Object)

encodeUrl

public java.lang.Object encodeUrl()

hashCode

public int hashCode()
See Also:
Object.hashCode()

getLdapEncoded

public java.lang.String getLdapEncoded()
Returns:
The LdapRdn as a string where the value is LDAP-encoded.


Copyright � 2002-2006. All Rights Reserved.