directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 54048 - incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema
Date Fri, 08 Oct 2004 05:16:11 GMT
Author: akarasulu
Date: Thu Oct  7 22:16:11 2004
New Revision: 54048

Modified:
   incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseAttributeType.java
Log:


Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseAttributeType.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseAttributeType.java
(original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/BaseAttributeType.java
Thu Oct  7 22:16:11 2004
@@ -42,8 +42,10 @@
     private AttributeType superior;
     /** a list of names for this attribute of this type */
     private ArrayList nameList = new ArrayList();
+    /** cache the names as an array */
+    private transient String[] nameArray;
     /** the optional description for this attributeType*/
-    private String desc;
+    private String descption;
     /** the equality matching rule for this attributeType */
     private MatchingRule equality;
     /** the substring matching rule for this attributeType */
@@ -61,9 +63,9 @@
     /** whether or not this type has been obsoleted */
     private boolean isObsolete = true;
     /** the usage for this attributeType */
-    private UsageEnum usage;
+    private UsageEnum usage = UsageEnum.USERAPPLICATIONS;
     /** the length of this attribute in bytes */
-    private int length = Integer.MAX_VALUE;
+    private int length = -1;
 
 
     // ------------------------------------------------------------------------
@@ -101,7 +103,18 @@
 
     public String[] getAllNames()
     {
-        return ( String[] ) nameList.toArray( ArrayUtils.EMPTY_STRING_ARRAY );
+        if ( nameList.isEmpty() )
+        {
+            return ArrayUtils.EMPTY_STRING_ARRAY;
+        }
+
+        if ( nameArray != null )
+        {
+            return nameArray;
+        }
+
+        nameArray = ( String[] ) nameList.toArray( ArrayUtils.EMPTY_STRING_ARRAY );
+        return nameArray;
     }
 
 
@@ -113,7 +126,7 @@
 
     public String getDescription()
     {
-        return desc;
+        return descption;
     }
 
 
@@ -152,12 +165,6 @@
     }
 
 
-    public String getDesc()
-    {
-        return desc;
-    }
-
-
     public MatchingRule getEquality()
     {
         return equality;
@@ -193,21 +200,22 @@
     // ------------------------------------------------------------------------
 
 
-    protected void setSuperior( AttributeType superior )
+    protected void setDescription( String description )
     {
-        this.superior = superior;
+        this.descption = description;
     }
 
 
-    protected void setNameList( ArrayList nameList )
+    protected void setSuperior( AttributeType superior )
     {
-        this.nameList = nameList;
+        this.superior = superior;
     }
 
 
-    protected void setDesc( String desc )
+    protected void setNameList( ArrayList nameList )
     {
-        this.desc = desc;
+        this.nameList = nameList;
+        this.nameArray = null;
     }
 
 

Mime
View raw message