directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r411555 - /directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
Date Sun, 04 Jun 2006 13:52:32 GMT
Author: elecharny
Date: Sun Jun  4 06:52:31 2006
New Revision: 411555

URL: http://svn.apache.org/viewvc?rev=411555&view=rev
Log:
Added two methods :
- add( Rdn )
- getRdn() which return the RDN

Modified:
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java?rev=411555&r1=411554&r2=411555&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
Sun Jun  4 06:52:31 2006
@@ -656,6 +656,25 @@
         }
     }
 
+    /**
+     * Retrieves the last component of this name.
+     * 
+     * @return the last component of this DN 
+     */
+    public Rdn getRdn()
+    {
+        if ( rdns.size() == 0 )
+        {
+            return null;
+        }
+        else
+        {
+            Rdn rdn = ( Rdn ) rdns.get( 0 );
+
+            return rdn;
+        }
+    }
+
 
     /**
      * Retrieves all the components of this name.
@@ -927,6 +946,23 @@
         return this;
     }
 
+    /**
+     * Adds a single component to the end of this name.
+     * 
+     * @param comp
+     *            the component to add
+     * @return the updated name (not a new one)
+     * @throws InvalidNameException
+     *             if adding <tt>comp</tt> would violate the syntax rules of
+     *             this name
+     */
+    public Name add( Rdn newRdn ) throws InvalidNameException
+    {
+        rdns.add( rdns.size() - 1, newRdn );
+        normalize( toUpName() );
+
+        return this;
+    }
 
     /**
      * Adds a single component at a specified position within this name.



Mime
View raw message