harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r549955 [6/16] - in /harmony/enhanced/classlib/trunk/modules/jndi/src/main/java: javax/naming/ javax/naming/directory/ javax/naming/event/ javax/naming/ldap/ javax/naming/spi/ org/apache/harmony/jndi/internal/ org/apache/harmony/jndi/intern...
Date Fri, 22 Jun 2007 20:48:56 GMT
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java
Fri Jun 22 13:48:49 2007
@@ -15,133 +15,128 @@
  * limitations under the License.
  */
 
-
 package javax.naming.directory;
 
 import java.io.Serializable;
 import javax.naming.NamingEnumeration;
 
 /**
- * This is the interface to a collection of attributes associated with a directory
- * entry.
+ * This is the interface to a collection of attributes associated with a
+ * directory entry.
  * <p>
  * This interface defines the methods that are implemented by a collection of a
- * particular directory entry's attributes.</p>
+ * particular directory entry's attributes.
+ * </p>
  * <p>
  * A directory entry can have zero or more attributes comprising its attributes
- * collection. The attributes are unordered within the collection.  The
- * attributes can be identified by name. The names of attributes are either
- * case sensitive or case insensitive as indicated by the <code>isCaseIgnored</code>
- * method. Method names refer to attribute ID (identity) rather than name, 
- * for brevity.</p>
+ * collection. The attributes are unordered within the collection. The
+ * attributes can be identified by name. The names of attributes are either case
+ * sensitive or case insensitive as indicated by the <code>isCaseIgnored</code>
+ * method. Method names refer to attribute ID (identity) rather than name, for
+ * brevity.
+ * </p>
  * <p>
- * The attribute collection is created when the directory entry is created.</p>
- *
- * 
+ * The attribute collection is created when the directory entry is created.
+ * </p>
  */
 public interface Attributes extends Cloneable, Serializable {
 
-    /*
-     * -------------------------------------------------------------------
-     * Methods
-     * -------------------------------------------------------------------
-     */
-
     /**
-     * Returns a deep copy of this <code>Attributes</code> instance. 
-     * The attribute objects are not cloned.
-     *
-     * @return              a deep copy of this <code>Attributes</code> instance
+     * Returns a deep copy of this <code>Attributes</code> instance. The
+     * attribute objects are not cloned.
+     * 
+     * @return a deep copy of this <code>Attributes</code> instance
      */
     Object clone();
 
     /**
-     * Returns the attribute with the specified name (ID).
-     * The name is case insensitive if <code>isCaseIgnored()</code> is true.
The
-     * return value is <code>null</code> if no match is found.
-     *
-     * @param id            attribute name (ID)
-     * @return              the attribute with the specified name (ID)
+     * Returns the attribute with the specified name (ID). The name is case
+     * insensitive if <code>isCaseIgnored()</code> is true. The return value
+     * is <code>null</code> if no match is found.
+     * 
+     * @param id
+     *            attribute name (ID)
+     * @return the attribute with the specified name (ID)
      */
     Attribute get(String id);
 
     /**
      * Returns an enumeration containing the zero or more attributes in the
-     * collection.
-     * The behaviour of the enumeration is not specified if the attribute 
-     * collection is changed.
-     *
-     * @return              an enumeration of all contained attributes
-     *
+     * collection. The behaviour of the enumeration is not specified if the
+     * attribute collection is changed.
+     * 
+     * @return an enumeration of all contained attributes
+     * 
      */
     NamingEnumeration<? extends javax.naming.directory.Attribute> getAll();
 
     /**
      * Returns an enumeration containing the zero or more names (IDs) of the
-     * attributes in the collection.
-     * The behaviour of the enumeration is not specified if the attribute 
-     * collection is changed.
-     *
-     * @return              an enumeration of the IDs of all contained attributes
+     * attributes in the collection. The behaviour of the enumeration is not
+     * specified if the attribute collection is changed.
+     * 
+     * @return an enumeration of the IDs of all contained attributes
      */
     NamingEnumeration<String> getIDs();
 
     /**
      * Indicates whether case is ignored in the names of the attributes.
-     *
-     * @return              true if case is ignored, otherwise false
+     * 
+     * @return true if case is ignored, otherwise false
      */
     boolean isCaseIgnored();
 
     /**
-     * Places a non-null attribute in the attribute collection.
-     * If there is already an attribute with the same ID as the new attribute,
-     * the old one is removed from the collection and is returned by this 
-     * method. If there was no attribute with the same ID the return value is
-     * <code>null</code>.
-     *
-     * @param attribute     the attribute to be put
-     * @return              the old attribute with the same ID, if exists;
-     *                      otherwise <code>null</code>
+     * Places a non-null attribute in the attribute collection. If there is
+     * already an attribute with the same ID as the new attribute, the old one
+     * is removed from the collection and is returned by this method. If there
+     * was no attribute with the same ID the return value is <code>null</code>.
+     * 
+     * @param attribute
+     *            the attribute to be put
+     * @return the old attribute with the same ID, if exists; otherwise
+     *         <code>null</code>
      */
     Attribute put(Attribute attribute);
 
     /**
-     * Places a new attribute with the supplied ID and value into the attribute 
-     * collection. 
-     * If there is already an attribute with the same ID, the old one is removed
-     * from the collection and is returned by this method. If there was no 
-     * attribute with the same ID the return value is <code>null</code>. The

-     * case of the ID is ignored if <code>isCaseIgnored()</code> is true.
-     *
-     * This method provides a mechanism to put an attribute with a <code>null</code>
-     * value: the value of <code>obj</code> may be <code>null</code>.
-     *
-     * @param id            the ID of the new attribute to be put
-     * @param obj           the value of the new attribute to be put
-     * @return              the old attribute with the same ID, if exists;
-     *                      otherwise <code>null</code>
+     * Places a new attribute with the supplied ID and value into the attribute
+     * collection. If there is already an attribute with the same ID, the old
+     * one is removed from the collection and is returned by this method. If
+     * there was no attribute with the same ID the return value is
+     * <code>null</code>. The case of the ID is ignored if
+     * <code>isCaseIgnored()</code> is true.
+     * 
+     * This method provides a mechanism to put an attribute with a
+     * <code>null</code> value: the value of <code>obj</code> may
be
+     * <code>null</code>.
+     * 
+     * @param id
+     *            the ID of the new attribute to be put
+     * @param obj
+     *            the value of the new attribute to be put
+     * @return the old attribute with the same ID, if exists; otherwise
+     *         <code>null</code>
      */
     Attribute put(String id, Object obj);
 
     /**
-     * Removes the attribute with the specified ID.
-     * The removed attribute is returned by this method. If there is no 
-     * attribute with the specified ID, the return value is <code>null</code>.

-     * The case of the ID is ignored if <code>isCaseIgnored()</code> is true.
+     * Removes the attribute with the specified ID. The removed attribute is
+     * returned by this method. If there is no attribute with the specified ID,
+     * the return value is <code>null</code>. The case of the ID is ignored
+     * if <code>isCaseIgnored()</code> is true.
      * 
-     * @param id            the ID of the attribute to be removed
-     * @return              the removed attribute, if exists; otherwise <code>null</code>
+     * @param id
+     *            the ID of the attribute to be removed
+     * @return the removed attribute, if exists; otherwise <code>null</code>
      */
     Attribute remove(String id);
 
     /**
      * Returns the number of attributes.
      * 
-     * @return              the number of attributes
+     * @return the number of attributes
      */
     int size();
 
 }
-
-

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttribute.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttribute.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttribute.java
Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 package javax.naming.directory;
 
 import java.io.IOException;
@@ -37,48 +36,38 @@
  * <p>
  * A basic attribute does not have any schema associated with it, and attempts
  * to get the schema result in an <code>OperationNotSupportedException</code>
- * being thrown.</p>
+ * being thrown.
+ * </p>
  * <p>
  * The definition of <code>equals</code> for an attribute is simply <code>
- * Object.equals</code> on the value, except for values that are collections 
- * where the definition of <code>equals</code> is an equivalence test (i.e. the

- * collection contains the same number of elements, and each has an equal 
- * element in the other collection). For an array, <code>Object.equals</code>
- * is used on each array element.</p>
+ * Object.equals</code>
+ * on the value, except for values that are collections where the definition of
+ * <code>equals</code> is an equivalence test (i.e. the collection contains
+ * the same number of elements, and each has an equal element in the other
+ * collection). For an array, <code>Object.equals</code> is used on each array
+ * element.
+ * </p>
  * <p>
  * Note that updates to a basic attribute do not update the directory itself --
  * updates to a directory are only possible through the {@link DirContext}
- * interface. <code>BasicAttribute</code> does not get its values dynamically

+ * interface. <code>BasicAttribute</code> does not get its values dynamically
  * from the directory. It uses the values passed to the constructor or add and
- * remove methods.</p>
+ * remove methods.
+ * </p>
  * 
  * @see Attribute
- * 
  */
 public class BasicAttribute implements Attribute {
 
     /*
-     * -------------------------------------------------------------------
-     * Constants
-     * -------------------------------------------------------------------
-     */
-
-    /*
-     * This constant is used during deserialization to check the J2SE version
-     * which created the serialized object.
-     */
-    static final long serialVersionUID = 0x5d95d32a668565beL; //J2SE 1.4.2
-
-    /*
-     * -------------------------------------------------------------------
-     * Instance variables
-     * -------------------------------------------------------------------
+     * This constant is used during deserialization to check the version which
+     * created the serialized object.
      */
+    static final long serialVersionUID = 0x5d95d32a668565beL;
 
     /**
-     * The attribute identifier. 
-     * It is initialized by the public constructors and is required to be not
-     * null.
+     * The attribute identifier. It is initialized by the public constructors
+     * and is required to be not null.
      * 
      * @serial
      */
@@ -87,40 +76,36 @@
     /**
      * Flag showing whether the values of the attribute are ordered.
      * 
-     * @serial 
+     * @serial
      */
     protected boolean ordered;
 
     /**
-     * <code>Vector</code> containing the attribute's values. 
-     * This is initialized by the public constructor and is required to be not 
-     * null.
+     * <code>Vector</code> containing the attribute's values. This is
+     * initialized by the public constructor and is required to be not null.
      */
     protected transient Vector<Object> values = new Vector<Object>();
 
-    /*
-     * -------------------------------------------------------------------
-     * Constructors
-     * -------------------------------------------------------------------
-     */
-
     /**
-     * Constructs an unordered <code>BasicAttribute</code> instance with the

+     * Constructs an unordered <code>BasicAttribute</code> instance with the
      * supplied identifier and no values.
      * 
-     * @param id            the attribute ID
+     * @param id
+     *            the attribute ID
      */
     public BasicAttribute(String id) {
         this(id, false);
     }
 
     /**
-     * Constructs a <code>BasicAttribute</code> instance with the supplied 
-     * identifier and no values. 
-     * The supplied flag controls whether the values will be ordered or not.
+     * Constructs a <code>BasicAttribute</code> instance with the supplied
+     * identifier and no values. The supplied flag controls whether the values
+     * will be ordered or not.
      * 
-     * @param id            the attribute ID
-     * @param flag          Indicates whether the values are ordered or not.
+     * @param id
+     *            the attribute ID
+     * @param flag
+     *            Indicates whether the values are ordered or not.
      */
     public BasicAttribute(String id, boolean flag) {
         attrID = id;
@@ -128,24 +113,29 @@
     }
 
     /**
-     * Constructs an unordered <code>BasicAttribute</code> instance with the

+     * Constructs an unordered <code>BasicAttribute</code> instance with the
      * supplied identifier and one value.
-     *  
-     * @param id            the attribute ID
-     * @param val           the first attribute value
+     * 
+     * @param id
+     *            the attribute ID
+     * @param val
+     *            the first attribute value
      */
     public BasicAttribute(String id, Object val) {
         this(id, val, false);
     }
 
     /**
-     * Constructs a <code>BasicAttribute</code> instance with the supplied 
-     * identifier and one value. 
-     * The supplied flag controls whether the values will be ordered or not.
+     * Constructs a <code>BasicAttribute</code> instance with the supplied
+     * identifier and one value. The supplied flag controls whether the values
+     * will be ordered or not.
      * 
-     * @param id            the attribute ID
-     * @param val           the first attribute value
-     * @param flag          Indicates whether the values are ordered or not.
+     * @param id
+     *            the attribute ID
+     * @param val
+     *            the first attribute value
+     * @param flag
+     *            Indicates whether the values are ordered or not.
      */
     public BasicAttribute(String id, Object val, boolean flag) {
         this(id, flag);
@@ -153,24 +143,19 @@
     }
 
     /*
-     * -------------------------------------------------------------------
-     * Methods
-     * -------------------------------------------------------------------
-     */
-
-    /*
      * Determine whether two values belonging to the two array classes
      * respectively are possible to be equal.
      */
-    private boolean compareValueClasses(Class<? extends Object> c1, Class<? extends
Object> c2) {
+    private boolean compareValueClasses(Class<? extends Object> c1,
+            Class<? extends Object> c2) {
         if ((c1.getName().startsWith("[L") || c1.getName().startsWith("[[")) && //$NON-NLS-1$
//$NON-NLS-2$
-            (c2.getName().startsWith("[L") || c2.getName().startsWith("[["))) { //$NON-NLS-1$
//$NON-NLS-2$
+                (c2.getName().startsWith("[L") || c2.getName().startsWith("[["))) { //$NON-NLS-1$
//$NON-NLS-2$
             /*
-             * If both Class are array of Object or array of array, the compare 
+             * If both Class are array of Object or array of array, the compare
              * result is true, even if their class name may not be the same.
              */
             return true;
-        } else if (c1.getName().equals(c2.getName())){
+        } else if (c1.getName().equals(c2.getName())) {
             /*
              * Otherwise, at least one of them must be array of basic types. If
              * both Class have the same Class name, the compare result is true.
@@ -186,8 +171,8 @@
 
     /*
      * Determine whether the two values are equal with each other, considering
-     * the possibility that they might be both arrays so that each element of 
-     * them has to be compared. 
+     * the possibility that they might be both arrays so that each element of
+     * them has to be compared.
      */
     private boolean compareValues(Object obj1, Object obj2) {
         if (null == obj1 && null == obj2) {
@@ -198,21 +183,20 @@
                 /*
                  * If both are array, compare each element if it is possible
                  * that they might be equal.
-                 */ 
+                 */
                 if (compareValueClasses(obj1.getClass(), obj2.getClass())) {
                     int i = Array.getLength(obj1);
                     Object val1;
                     Object val2;
-                                        
+
                     // Compare each element of the two arrays
                     if (Array.getLength(obj2) == i) {
                         // Do the compare only if their lengths are equal
                         for (i--; i >= 0; i--) {
                             val1 = Array.get(obj1, i);
                             val2 = Array.get(obj2, i);
-                            if (null == val1
-                                ? null != val2
-                                : !val1.equals(val2)) {
+                            if (null == val1 ? null != val2 : !val1
+                                    .equals(val2)) {
                                 /*
                                  * If any of their elements at the same position
                                  * are not equal,they are not equal.
@@ -238,9 +222,9 @@
     }
 
     /*
-     * Get the hash code of an attribute value, which might be an array whose 
+     * Get the hash code of an attribute value, which might be an array whose
      * hash code is the sum of all its element. Base types are converted into
-     * corresponding wrapper class objects.     
+     * corresponding wrapper class objects.
      */
     private int hashCodeOfValue(Object obj) {
         int hashcode = 0;
@@ -265,19 +249,13 @@
         return hashcode;
     }
 
-    /*
-     * -------------------------------------------------------------------
-     * Methods of Interface Attribute
-     * -------------------------------------------------------------------
-     */
-
     public void add(int index, Object val) {
         if (ordered) {
             values.add(index, val);
         } else {
             if (contains(val)) {
                 // jndi.16=Value already exists.
-                throw new IllegalStateException(Messages.getString("jndi.16"));  //$NON-NLS-1$
+                throw new IllegalStateException(Messages.getString("jndi.16")); //$NON-NLS-1$
             }
             values.add(index, val);
         }
@@ -297,7 +275,7 @@
         values.clear();
     }
 
-    @SuppressWarnings("unchecked") //$NON-NLS-1$
+    @SuppressWarnings("unchecked")
     @Override
     public Object clone() {
         try {
@@ -306,7 +284,7 @@
             return attr;
         } catch (CloneNotSupportedException e) {
             // jndi.17=Failed to clone object of BasicAttribute class.
-            throw new AssertionError(Messages.getString("jndi.17"));  //$NON-NLS-1$
+            throw new AssertionError(Messages.getString("jndi.17")); //$NON-NLS-1$
         }
     }
 
@@ -324,7 +302,7 @@
     public Object get() throws NamingException {
         if (0 == values.size()) {
             // jndi.18=No values available.
-            throw new NoSuchElementException(Messages.getString("jndi.18"));  //$NON-NLS-1$
+            throw new NoSuchElementException(Messages.getString("jndi.18")); //$NON-NLS-1$
         }
         return values.get(0);
     }
@@ -339,12 +317,12 @@
 
     public DirContext getAttributeDefinition() throws NamingException {
         // jndi.19=BasicAttribute does not support this operation.
-        throw new OperationNotSupportedException(Messages.getString("jndi.19"));  //$NON-NLS-1$
+        throw new OperationNotSupportedException(Messages.getString("jndi.19")); //$NON-NLS-1$
     }
 
     public DirContext getAttributeSyntaxDefinition() throws NamingException {
         // jndi.19=BasicAttribute does not support this operation.
-        throw new OperationNotSupportedException(Messages.getString("jndi.19"));  //$NON-NLS-1$
+        throw new OperationNotSupportedException(Messages.getString("jndi.19")); //$NON-NLS-1$
     }
 
     public String getID() {
@@ -374,7 +352,7 @@
     public Object set(int index, Object val) {
         if (!ordered && contains(val)) {
             // jndi.16=Value already exists.
-            throw new IllegalStateException(Messages.getString("jndi.16"));  //$NON-NLS-1$
+            throw new IllegalStateException(Messages.getString("jndi.16")); //$NON-NLS-1$
         }
         return values.set(index, val);
     }
@@ -384,20 +362,12 @@
     }
 
     /*
-     * -------------------------------------------------------------------
-     * Methods override parent class Object
-     * -------------------------------------------------------------------
+     * Serialization of the BasicAttribute class is as follows: attribute
+     * identifier (String) ordered flag (boolean) number of values (int) list of
+     * value objects
      */
-
-    /*
-     * Serialization of the <code>BasicAttribute</code> class is as follows:
-     *      attribute identifier (String)
-     *      ordered flag (boolean)
-     *      number of values (int)
-     *      list of value objects
-     */
-    private void readObject(ObjectInputStream ois)
-        throws IOException, ClassNotFoundException {
+    private void readObject(ObjectInputStream ois) throws IOException,
+            ClassNotFoundException {
         int size;
 
         ois.defaultReadObject();
@@ -409,11 +379,9 @@
     }
 
     /*
-     * Serialization of the <code>BasicAttribute</code> class is as follows:
-     *      attribute identifier (String)
-     *      ordered flag (boolean)
-     *      number of values (int)
-     *      list of value objects
+     * Serialization of the BasicAttribute class is as follows: attribute
+     * identifier (String) ordered flag (boolean) number of values (int) list of
+     * value objects
      */
     private void writeObject(ObjectOutputStream oos) throws IOException {
         oos.defaultWriteObject();
@@ -424,18 +392,20 @@
     }
 
     /**
-     * Returns true if this <code>BasicAttribute</code> instance is equal to
the
-     * supplied object <code>obj</code>.
-     * Two attributes are considered equal if they have equal identifiers, 
-     * schemas and values. BasicAttribute uses no schema.
+     * Returns true if this <code>BasicAttribute</code> instance is equal to
+     * the supplied object <code>obj</code>. Two attributes are considered
+     * equal if they have equal identifiers, schemas and values. BasicAttribute
+     * uses no schema.
      * <p>
-     * <code>Object.equals</code> is used to test equality of identifiers and

-     * values. For array values <code>Object.equals</code> is called on every

-     * array element.</p>
-     *
-     * @param obj           the object to be compared with
-     * @return              true if this object is equal to <code>obj</code>,
-     *                      otherwise false
+     * <code>Object.equals</code> is used to test equality of identifiers and
+     * values. For array values <code>Object.equals</code> is called on every
+     * array element.
+     * </p>
+     * 
+     * @param obj
+     *            the object to be compared with
+     * @return true if this object is equal to <code>obj</code>, otherwise
+     *         false
      */
     @Override
     public boolean equals(Object obj) {
@@ -484,13 +454,12 @@
     }
 
     /**
-     * Returns the hashcode for this <code>BasicAttribute</code> instance.
-     * The result is calculated by summing the hashcodes for the identifier
-     * and each of the values, except for array values, where the hashcodes
-     * for each array element are summed.
+     * Returns the hashcode for this <code>BasicAttribute</code> instance. The
+     * result is calculated by summing the hashcodes for the identifier and each
+     * of the values, except for array values, where the hashcodes for each
+     * array element are summed.
      * 
-     * @return              the hashcode of this <code>BasicAttribute</code>
-     *                      instance
+     * @return the hashcode of this <code>BasicAttribute</code> instance
      */
     @Override
     public int hashCode() {
@@ -510,10 +479,10 @@
 
     /**
      * Returns the string representation of this <code>BasicAttribute</code>
-     * instance.
-     * The result contains the ID and the string representation of each value.
+     * instance. The result contains the ID and the string representation of
+     * each value.
      * 
-     * @return              the string representation of this object
+     * @return the string representation of this object
      */
     @Override
     public String toString() {
@@ -533,5 +502,3 @@
     }
 
 }
-
-

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttributes.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttributes.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttributes.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttributes.java
Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 package javax.naming.directory;
 
 import java.io.IOException;
@@ -33,60 +32,45 @@
 /**
  * A simple implementation of the <code>Attributes</code> interface.
  * <p>
- * The <code>BasicAttributes</code> provides operations on any types of 
+ * The <code>BasicAttributes</code> provides operations on any types of
  * attribute. When a new attribute is created the <code>BasicAttributes</code>
- * class will create a new <code>BasicAttribute</code> and add it to the 
- * attribute collection.</p>
+ * class will create a new <code>BasicAttribute</code> and add it to the
+ * attribute collection.
+ * </p>
  * <p>
- * A particular instance of <code>BasicAttributes</code> can be either 
+ * A particular instance of <code>BasicAttributes</code> can be either
  * case-sensitive or case-insensitive, as defined by the <code>isCaseIgnored()
- * </code> method.</p>
+ * </code>
+ * method.
+ * </p>
  * <p>
  * Note that changes to the <code>BasicAttributes</code> are local -- they do
  * not modify the directory. The directory is only modified by API calls on the
- * {@link DirContext} object.</p>
- *
- * @see Attributes
+ * {@link DirContext} object.
+ * </p>
  * 
+ * @see Attributes
  */
 public class BasicAttributes implements Attributes {
 
     /*
-     * -------------------------------------------------------------------
-     * Constants
-     * -------------------------------------------------------------------
-     */
-
-    /*
-     * This constant is used during deserialization to check the J2SE version 
-     * which created the serialized object.
-     */
-    static final long serialVersionUID = 0x451d18d6a95539d8L; //J2SE 1.4.2
-
-    /*
-     * -------------------------------------------------------------------
-     * Instance variables
-     * -------------------------------------------------------------------
+     * This constant is used during deserialization to check the version which
+     * created the serialized object.
      */
+    static final long serialVersionUID = 0x451d18d6a95539d8L;
 
     /**
      * Flag indicating whether the case of attribute identifier is ignored.
      * 
      * @serial
-     */ 
+     */
     private boolean ignoreCase;
 
     // A map, Id => Attribute
-    private transient Hashtable<String,Attribute> attrMap = new Hashtable<String,Attribute>();
-
-    /*
-     * -------------------------------------------------------------------
-     * Constructors
-     * -------------------------------------------------------------------
-     */
+    private transient Hashtable<String, Attribute> attrMap = new Hashtable<String,
Attribute>();
 
     /**
-     * Constructs a <code>BasicAttributes</code> instance which is 
+     * Constructs a <code>BasicAttributes</code> instance which is
      * case-sensitive.
      */
     public BasicAttributes() {
@@ -94,22 +78,24 @@
     }
 
     /**
-     * Constructs a <code>BasicAttributes</code> instance which is 
+     * Constructs a <code>BasicAttributes</code> instance which is
      * case-sensitive if <code>flag</code> is false.
      * 
-     * @param flag          Indicates whether this instance is 
-     *                      case-insensitive.
+     * @param flag
+     *            Indicates whether this instance is case-insensitive.
      */
     public BasicAttributes(boolean flag) {
         this.ignoreCase = flag;
     }
 
     /**
-     * Constructs a case-sensitive <code>BasicAttributes</code> instance 
-     * with one attribute.
+     * Constructs a case-sensitive <code>BasicAttributes</code> instance with
+     * one attribute.
      * 
-     * @param attrId        the ID of the first attribute
-     * @param attrObj       the value of the first attribute
+     * @param attrId
+     *            the ID of the first attribute
+     * @param attrObj
+     *            the value of the first attribute
      */
     public BasicAttributes(String attrId, Object attrObj) {
         this(attrId, attrObj, false);
@@ -119,37 +105,27 @@
      * Constructs a <code>BasicAttributes</code> instance with one attribute
      * which is case-sensitive if <code>flag</code> is false.
      * 
-     * @param attrId        the ID of the first attribute
-     * @param attrObj       the value of the first attribute
-     * @param flag          Indicates whether this instance is 
-     *                      case-insensitive.
+     * @param attrId
+     *            the ID of the first attribute
+     * @param attrObj
+     *            the value of the first attribute
+     * @param flag
+     *            Indicates whether this instance is case-insensitive.
      */
     public BasicAttributes(String attrId, Object attrObj, boolean flag) {
         this.ignoreCase = flag;
-        this.attrMap.put(convertId(attrId),
-            new BasicAttribute(attrId, attrObj));
+        this.attrMap
+                .put(convertId(attrId), new BasicAttribute(attrId, attrObj));
     }
 
     /*
-     * -------------------------------------------------------------------
-     * Methods
-     * -------------------------------------------------------------------
-     */
-    
-    /*
      * Convert an attribute ID to lower case if this attribute collection is
      * case-insensitive.
-     */ 
+     */
     private String convertId(String id) {
         return ignoreCase ? id.toLowerCase() : id;
     }
 
-    /*
-     * -------------------------------------------------------------------
-     * Methods of Interface Attributes
-     * -------------------------------------------------------------------
-     */
-
     public Attribute get(String id) {
         return attrMap.get(convertId(id));
     }
@@ -194,24 +170,17 @@
     }
 
     /*
-     * -------------------------------------------------------------------
-     * Methods override parent class Object
-     * -------------------------------------------------------------------
-     */
-
-    /*
      * Serialization of the <code>BasicAttributes</code> class is as follows:
-     *      ignore attribute case (boolean)
-     *      number of attributes (int)
-     *      list of attribute objects
+     * ignore attribute case (boolean) number of attributes (int) list of
+     * attribute objects
      */
-    private void readObject(ObjectInputStream ois)
-        throws IOException, ClassNotFoundException {
+    private void readObject(ObjectInputStream ois) throws IOException,
+            ClassNotFoundException {
         int size;
 
         ois.defaultReadObject();
         size = ois.readInt();
-        attrMap = new Hashtable<String,Attribute>();
+        attrMap = new Hashtable<String, Attribute>();
         for (int i = 0; i < size; i++) {
             BasicAttribute attr = (BasicAttribute) ois.readObject();
             attrMap.put(convertId(attr.getID()), attr);
@@ -220,48 +189,50 @@
 
     /*
      * Serialization of the <code>BasicAttributes</code> class is as follows:
-     *      ignore attribute case (boolean)
-     *      number of attributes (int)
-     *      list of attribute objects
+     * ignore attribute case (boolean) number of attributes (int) list of
+     * attribute objects
      */
     private void writeObject(ObjectOutputStream oos) throws IOException {
         oos.defaultWriteObject();
         oos.writeInt(attrMap.size());
-        for (Enumeration<Attribute> enumeration = attrMap.elements(); enumeration.hasMoreElements();)
{
+        for (Enumeration<Attribute> enumeration = attrMap.elements(); enumeration
+                .hasMoreElements();) {
             oos.writeObject(enumeration.nextElement());
         }
     }
 
     /**
-     * Returns a deep copy of this attribute collection.
-     * The returned copy contains the same attribute objects. The attribute
-     * objects are not cloned.
-     *
-     * @return              a deep copy of this attribute collection
+     * Returns a deep copy of this attribute collection. The returned copy
+     * contains the same attribute objects. The attribute objects are not
+     * cloned.
+     * 
+     * @return a deep copy of this attribute collection
      */
-    @SuppressWarnings("unchecked") //$NON-NLS-1$
+    @SuppressWarnings("unchecked")
     @Override
     public Object clone() {
         try {
             BasicAttributes c = (BasicAttributes) super.clone();
-            c.attrMap = (Hashtable<String,Attribute>) this.attrMap.clone();
+            c.attrMap = (Hashtable<String, Attribute>) this.attrMap.clone();
             return c;
         } catch (CloneNotSupportedException e) {
             // jndi.15=Failed to clone object of BasicAttributes class.
-            throw new AssertionError(Messages.getString("jndi.15"));  //$NON-NLS-1$
+            throw new AssertionError(Messages.getString("jndi.15")); //$NON-NLS-1$
         }
     }
 
     /**
-     * Returns true if this <code>BasicAttributes</code> instance is equal to

-     * the supplied object <code>obj</code>.
-     * They are considered equal if they handle case the same way and have equal
-     * attributes. <code>Attribute</code> equality is tested by calling <code>
-     * equals</code> on each attribute, which may be overridden.
+     * Returns true if this <code>BasicAttributes</code> instance is equal to
+     * the supplied object <code>obj</code>. They are considered equal if
+     * they handle case the same way and have equal attributes.
+     * <code>Attribute</code> equality is tested by calling <code>
+     * equals</code>
+     * on each attribute, which may be overridden.
      * 
-     * @param obj           the object to compare with
-     * @return              true if this object is equal to <code>obj</code>,
-     *                      otherwise false
+     * @param obj
+     *            the object to compare with
+     * @return true if this object is equal to <code>obj</code>, otherwise
+     *         false
      */
     @Override
     public boolean equals(Object obj) {
@@ -276,9 +247,10 @@
         }
 
         // compare each attribute
-        Iterator<Map.Entry<String,Attribute>> it = attrMap.entrySet().iterator();
+        Iterator<Map.Entry<String, Attribute>> it = attrMap.entrySet()
+                .iterator();
         while (it.hasNext()) {
-            Map.Entry<String,Attribute> e = it.next();
+            Map.Entry<String, Attribute> e = it.next();
             if (!e.getValue().equals(o.get(e.getKey()))) {
                 return false;
             }
@@ -292,8 +264,7 @@
      * The result is calculated by summing the hashcodes of all attributes,
      * incremented by one if this instance is not case-sensitive.
      * 
-     * @return              the hashcode of this <code>BasicAttributes</code>
-     *                      instance
+     * @return the hashcode of this <code>BasicAttributes</code> instance
      */
     @Override
     public int hashCode() {
@@ -309,18 +280,18 @@
 
     /**
      * Returns the string representation of this <code>BasicAttributes</code>
-     * instance.
-     * The result contains the attribute identifiers and values' string
-     * representations.
+     * instance. The result contains the attribute identifiers and values'
+     * string representations.
      * 
-     * @return              the string representation of this object
+     * @return the string representation of this object
      */
     @Override
     public String toString() {
         String s = null;
-        Iterator<Map.Entry<String,Attribute>> it = attrMap.entrySet().iterator();
-        Map.Entry<String,Attribute> e = null;
-        
+        Iterator<Map.Entry<String, Attribute>> it = attrMap.entrySet()
+                .iterator();
+        Map.Entry<String, Attribute> e = null;
+
         if (it.hasNext()) {
             // If there are one or more attributes, print them all.
             e = it.next();

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicNamingEnumeration.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicNamingEnumeration.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicNamingEnumeration.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicNamingEnumeration.java
Fri Jun 22 13:48:49 2007
@@ -23,39 +23,22 @@
 import javax.naming.NamingException;
 
 /**
- * a simple implementation of NamingEnumeration
- * 
+ * A simple implementation of NamingEnumeration
  */
 class BasicNamingEnumeration<T> implements NamingEnumeration<T> {
 
-    /*
-     * -----------------------------------
-     * Fields
-     * -----------------------------------
-     */
-
     private Enumeration<T> enumeration;
 
-    /*
-   	 * -----------------------------------
-     * Constructors
-     * -----------------------------------
-     */
-
     /**
-     * default constructor
-     * @param e			wrapped enumeration
+     * Default constructor
+     * 
+     * @param e
+     *            wrapped enumeration
      */
     public BasicNamingEnumeration(Enumeration<T> e) {
         this.enumeration = e;
     }
 
-	/*
-	 * -----------------------------------
-	 * Methods of interface NamingEnumeration
-	 * -----------------------------------
-	 */
-
     public T next() throws NamingException {
         return enumeration.nextElement();
     }
@@ -65,7 +48,7 @@
     }
 
     public void close() throws NamingException {
-    	// Does nothing.
+        // Does nothing.
     }
 
     public boolean hasMoreElements() {
@@ -77,5 +60,3 @@
     }
 
 }
-
-



Mime
View raw message