directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 47460 - incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema
Date Wed, 29 Sep 2004 05:15:41 GMT
Author: akarasulu
Date: Tue Sep 28 22:15:41 2004
New Revision: 47460

Modified:
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AttributeType.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultAttributeType.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DescriptionUtils.java
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java
Log:
reverted back to using object arrays instead of lists

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AttributeType.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AttributeType.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/AttributeType.java
Tue Sep 28 22:15:41 2004
@@ -16,8 +16,6 @@
  */
 package org.apache.ldap.common.schema;
 
-import java.util.List;
-
 
 /**
  * An attributeType specification.  attributeType specifications describe the
@@ -146,7 +144,7 @@
      *
      * @return String names for this AttributeType
      */
-    List getAllNames();
+    String[] getAllNames();
 
     /**
      * Gets a description for this AttributeType.

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultAttributeType.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultAttributeType.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultAttributeType.java
Tue Sep 28 22:15:41 2004
@@ -19,9 +19,9 @@
 
 import java.io.Serializable;
 
-import java.util.List;
 import java.util.ArrayList;
-import java.util.Collections;
+
+import org.apache.ldap.common.util.ArrayUtils;
 
 
 /**
@@ -84,9 +84,9 @@
     }
 
 
-    public List getAllNames()
+    public String[] getAllNames()
     {
-        return Collections.unmodifiableList( nameList );
+        return ( String[] ) nameList.toArray( ArrayUtils.EMPTY_STRING_ARRAY );
     }
 
 

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java
Tue Sep 28 22:15:41 2004
@@ -19,7 +19,6 @@
 
 import java.util.List;
 import java.util.ArrayList;
-import java.util.Collections;
 
 import java.io.Serializable;
 
@@ -33,6 +32,10 @@
  */
 public class DefaultObjectClass implements ObjectClass, Serializable
 {
+    /** empty array of ObjectClasses so we do not have to recreate objects */
+    private static final ObjectClass[] EMPTY_OCLASS_ARR = new ObjectClass[0];
+    /** empty array of AttributeTypes so we do not have to recreate objects */
+    private static final AttributeType[] EMPTY_ATYPE_ARR = new AttributeType[0];
 
     // ------------------------------------------------------------------------
     // Specification Variables
@@ -77,14 +80,14 @@
     // ------------------------------------------------------------------------
 
 
-    public List getSuperClasses()
+    public ObjectClass[] getSuperClasses()
     {
         if ( superClasses == null )
         {
-            return Collections.EMPTY_LIST;
+            return EMPTY_OCLASS_ARR;
         }
 
-        return Collections.unmodifiableList( superClasses );
+        return ( ObjectClass[] ) superClasses.toArray( EMPTY_OCLASS_ARR );
     }
 
 
@@ -94,25 +97,25 @@
     }
 
 
-    public List getMustList()
+    public AttributeType[] getMustList()
     {
         if ( mustList == null )
         {
-            return Collections.EMPTY_LIST;
+            return EMPTY_ATYPE_ARR;
         }
 
-        return Collections.unmodifiableList( mustList );
+        return ( AttributeType[] ) mustList.toArray( EMPTY_ATYPE_ARR );
     }
 
 
-    public List getMayList()
+    public AttributeType[] getMayList()
     {
         if ( mayList == null )
         {
-            return Collections.EMPTY_LIST;
+            return EMPTY_ATYPE_ARR;
         }
 
-        return Collections.unmodifiableList( mayList );
+        return ( AttributeType[] ) mayList.toArray( EMPTY_ATYPE_ARR );
     }
 
 

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DescriptionUtils.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DescriptionUtils.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DescriptionUtils.java
Tue Sep 28 22:15:41 2004
@@ -16,8 +16,6 @@
  */
 package org.apache.ldap.common.schema;
 
-import java.util.List;
-
 
 /**
  * Utility class used to generate schema object specifications.  Some of the 
@@ -479,14 +477,14 @@
             buf.append( '\n' );
         }
         
-        List sups = objectClass.getSuperClasses();
-        if ( sups != null && sups.size() > 0 )
+        ObjectClass[] sups = objectClass.getSuperClasses();
+        if ( sups != null && sups.length > 0 )
         {
             buf.append( "SUP\n" );
-            for ( int ii = 0; ii < sups.size(); ii++ )
+            for ( int ii = 0; ii < sups.length; ii++ )
             {
                 buf.append( '\t' );
-                buf.append( ( ( ObjectClass ) sups.get( ii ) ).getOid() );
+                buf.append( sups[ii].getOid() );
                 buf.append( '\n' );
             }
         }
@@ -497,26 +495,26 @@
             buf.append( '\n' );
         }
         
-        List must = objectClass.getMustList();
-        if ( must != null && must.size() > 0 )
+        AttributeType[] must = objectClass.getMustList();
+        if ( must != null && must.length > 0 )
         {
             buf.append( "MUST\n" );
-            for ( int ii = 0; ii < must.size(); ii++ )
+            for ( int ii = 0; ii < must.length; ii++ )
             {
                 buf.append( '\t' );
-                buf.append( ( ( AttributeType ) must.get( ii ) ).getOid() );
+                buf.append( must[ii].getOid() );
                 buf.append( '\n' );
             }
         }
         
-        List may = objectClass.getMayList();
-        if ( may != null && may.size() > 0 )
+        AttributeType[] may = objectClass.getMayList();
+        if ( may != null && may.length > 0 )
         {
             buf.append( "MAY\n" );
-            for ( int ii = 0; ii < may.size(); ii++ )
+            for ( int ii = 0; ii < may.length; ii++ )
             {
                 buf.append( '\t' );
-                buf.append( ( ( AttributeType ) may.get( ii ) ).getOid() );
+                buf.append( may[ii].getOid() );
                 buf.append( '\n' );
             }
         }

Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java
Tue Sep 28 22:15:41 2004
@@ -16,9 +16,6 @@
  */
 package org.apache.ldap.common.schema;
 
-import java.util.Collection;
-import java.util.List;
-
 
 /**
  * An objectClass definition.  
@@ -99,7 +96,7 @@
      *
      * @return the superclasses
      */
-    List getSuperClasses();
+    ObjectClass[] getSuperClasses();
 
     /**
      * Gets the type of this ObjectClass as a type safe enum.
@@ -115,7 +112,7 @@
      * @return the AttributeTypes of attributes that must be within entries of
      * this ObjectClass
      */
-    List getMustList();
+    AttributeType[] getMustList();
 
     /**
      * Gets the AttributeTypes whose attributes may be present within an entry
@@ -124,5 +121,5 @@
      * @return the AttributeTypes of attributes that may be within entries of
      * this ObjectClass
      */
-    List getMayList();
+    AttributeType[] getMayList();
 }

Mime
View raw message