directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r476883 - in /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema: DescriptionUtils.java ObjectClassTypeEnum.java SchemaUtils.java
Date Sun, 19 Nov 2006 19:01:13 GMT
Author: elecharny
Date: Sun Nov 19 11:01:13 2006
New Revision: 476883

URL: http://svn.apache.org/viewvc?view=rev&rev=476883
Log:
Changed the ObjectClassTypeEnum to become an enum instead of an subclass
of ValuedEnum (Java 5 migration)

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DescriptionUtils.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeEnum.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DescriptionUtils.java?view=diff&rev=476883&r1=476882&r2=476883
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DescriptionUtils.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DescriptionUtils.java
Sun Nov 19 11:01:13 2006
@@ -515,7 +515,7 @@
 
         if ( objectClass.getType() != null )
         {
-            buf.append( objectClass.getType().getName() );
+            buf.append( objectClass.getType() );
             buf.append( '\n' );
         }
 

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeEnum.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeEnum.java?view=diff&rev=476883&r1=476882&r2=476883
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeEnum.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClassTypeEnum.java
Sun Nov 19 11:01:13 2006
@@ -20,13 +20,6 @@
 package org.apache.directory.shared.ldap.schema;
 
 
-import java.util.Map;
-import java.util.List;
-
-import org.apache.directory.shared.ldap.util.EnumUtils;
-import org.apache.directory.shared.ldap.util.ValuedEnum;
-
-
 /**
  * Type safe enumerations for an objectClass' type. An ObjectClass type can be
  * one of the following types:
@@ -37,31 +30,21 @@
  * </ul>
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
  */
-public class ObjectClassTypeEnum extends ValuedEnum
+public enum ObjectClassTypeEnum
 {
-    static final long serialVersionUID = -5916723482518366208L;
-
     /** The enumeration constant value for the abstract objectClasses */
-    public static final int ABSTRACT_VAL = 0;
+    ABSTRACT( 0 ),
 
     /** The enumeration constant value for the auxillary objectClasses */
-    public static final int AUXILLARY_VAL = 1;
+    AUXILIARY( 1 ),
 
     /** The enumeration constant value for the structural objectClasses */
-    public static final int STRUCTURAL_VAL = 2;
-
-    /** ValuedEnum for abstract objectClasses */
-    public static final ObjectClassTypeEnum ABSTRACT = new ObjectClassTypeEnum( "ABSTRACT",
ABSTRACT_VAL );
-
-    /** ValuedEnum for auxillary objectClasses */
-    public static final ObjectClassTypeEnum AUXILIARY = new ObjectClassTypeEnum( "AUXILIARY",
AUXILLARY_VAL );
-
-    /** ValuedEnum for structural objectClasses */
-    public static final ObjectClassTypeEnum STRUCTURAL = new ObjectClassTypeEnum( "STRUCTURAL",
STRUCTURAL_VAL );
-
+    STRUCTURAL( 2 );
 
+    /** Stores the integer value of each element of the enumeration */
+    private int value;
+    
     /**
      * Private constructor so no other instances can be created other than the
      * public static constants in this class.
@@ -71,18 +54,26 @@
      * @param value
      *            the integer value of the enumeration.
      */
-    private ObjectClassTypeEnum(final String name, final int value)
+    private ObjectClassTypeEnum( int value )
     {
-        super( name, value );
+        this.value = value;
     }
 
+    
+    /**
+     * @return The value associated with the current element.
+     */
+    public int getValue()
+    {
+        return value;
+    }
 
     /**
      * Gets the objectClass type enumeration of AUXILIARY, STRUCTURAL, or,
      * ABSTRACT.
      * 
-     * @param name
-     *            options are AUXILIARY, STRUCTURAL, or, ABSTRACT
+     * @param name options are AUXILIARY, STRUCTURAL, or, ABSTRACT
+     * 
      * @return the type safe enumeration for the objectClass type
      */
     public static ObjectClassTypeEnum getClassType( String name )
@@ -104,28 +95,5 @@
 
         throw new IllegalArgumentException( "Unknown objectClass type name '" + name
             + "': options are AUXILIARY, STRUCTURAL, ABSTRACT." );
-    }
-
-
-    /**
-     * Gets a List of the enumerations for the ObjectClass type.
-     * 
-     * @return the List of enumerations possible for ObjectClass types
-     */
-    public static List list()
-    {
-        return EnumUtils.getEnumList( ObjectClassTypeEnum.class );
-    }
-
-
-    /**
-     * Gets the Map of ClassTypeEnum objects by name using the ClassTypeEnum
-     * class.
-     * 
-     * @return the Map by name of ClassTypeEnums
-     */
-    public static Map map()
-    {
-        return EnumUtils.getEnumMap( ObjectClassTypeEnum.class );
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java?view=diff&rev=476883&r1=476882&r2=476883
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
Sun Nov 19 11:01:13 2006
@@ -273,7 +273,7 @@
 
         if ( oc.getType() != null )
         {
-            buf.append( " " ).append( oc.getType().getName() );
+            buf.append( " " ).append( oc.getType() );
         }
 
         if ( oc.getMustList() != null && oc.getMustList().length > 0 )



Mime
View raw message