You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2005/09/15 06:15:24 UTC

svn commit: r289141 - in /directory/asn1/trunk/ber/src: java/org/apache/asn1/ber/ java/org/apache/asn1/ber/primitives/ test/org/apache/asn1/ber/

Author: akarasulu
Date: Wed Sep 14 21:15:15 2005
New Revision: 289141

URL: http://svn.apache.org/viewcvs?rev=289141&view=rev
Log:
removing deps on commons lang enum which is causing warnings when compiling with jdk 1.5

Modified:
    directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BERDecoderState.java
    directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TagEnum.java
    directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TypeClass.java
    directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/primitives/UniversalTag.java
    directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BERDecoderStateTest.java
    directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/TypeClassTest.java

Modified: directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BERDecoderState.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BERDecoderState.java?rev=289141&r1=289140&r2=289141&view=diff
==============================================================================
--- directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BERDecoderState.java (original)
+++ directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/BERDecoderState.java Wed Sep 14 21:15:15 2005
@@ -17,13 +17,6 @@
 package org.apache.asn1.ber ;
 
 
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang.enum.EnumUtils;
-import org.apache.commons.lang.enum.ValuedEnum;
-
-
 /**
  * A type safe enumeration representing the state of a BERDecoder.  This can 
  * take one of the following three values: 
@@ -44,7 +37,7 @@
  *      Apache Directory Project</a>
  * @version $Rev$
  */
-public final class BERDecoderState extends ValuedEnum
+public final class BERDecoderState
 {
     /** value for the TAG state */
     public static final int TAG_VAL = 0 ;
@@ -63,7 +56,12 @@
     public static final BERDecoderState VALUE = 
         new BERDecoderState( "VALUE", VALUE_VAL ) ;
 
-    
+    /** the name of this enumeration element */
+    private final String name;
+    /** the value of this enumeration element */
+    private final int value;
+
+
     /**
      * Private constructor so no other instances can be created other than the
      * public static constants in this class.
@@ -73,10 +71,33 @@
      */
     private BERDecoderState( final String name, final int value )
     {
-        super( name, value ) ;
+        this.name = name;
+        this.value = value;
     }
-    
-    
+
+
+    /**
+     * Get's the name of this enumeration element.
+     *
+     * @return the name of the enumeration element
+     */
+    public final String getName()
+    {
+        return this.name;
+    }
+
+
+    /**
+     * Get's the value of this enumeration element.
+     *
+     * @return the value of the enumeration element
+     */
+    public final int getValue()
+    {
+        return this.value;
+    }
+
+
     /**
      * Gets the next state after this BERDecoderState based on the nature of the
      * present TLV being processed.
@@ -219,29 +240,6 @@
     }
     
     
-    /**
-     * Gets a List of the enumerations for the decoder states.
-     * 
-     * @return the List of enumerations possible for decoder states
-     */
-    public final static List list()
-    {
-        return EnumUtils.getEnumList( BERDecoderState.class ) ;
-    }
-    
-    
-    /**
-     * Gets the Map of decoder state objects by name using the BERDecoderState 
-     * class.
-     * 
-     * @return the Map by name of the BERDecoderState
-     */
-    public final static Map map()
-    {
-        return EnumUtils.getEnumMap( BERDecoderState.class ) ;
-    }
-
-
     /**
      * Gets the state of the decoder using a state value.
      * 

Modified: directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TagEnum.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TagEnum.java?rev=289141&r1=289140&r2=289141&view=diff
==============================================================================
--- directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TagEnum.java (original)
+++ directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TagEnum.java Wed Sep 14 21:15:15 2005
@@ -17,9 +17,6 @@
 package org.apache.asn1.ber ;
 
 
-import org.apache.commons.lang.enum.ValuedEnum;
-
-
 /**
  * Abstract base class for type safe tag enumerations following the agreed upon
  * convention for representing tags as integers.  This way the type safe
@@ -30,16 +27,43 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class TagEnum extends ValuedEnum
+public abstract class TagEnum
 {
     /** the id for this tag */
     private final int id ;
+    /** the name of this enumeration element */
+    private final String name;
+    /** the value of this enumeration element */
+    private final int value;
 
 
     protected TagEnum( final String name, final int value, final int id )
     {
-        super( name, value ) ;
         this.id = id ;
+        this.name = name;
+        this.value = value;
+    }
+
+
+    /**
+     * Get's the name of this enumeration element.
+     *
+     * @return the name of the enumeration element
+     */
+    public final String getName()
+    {
+        return this.name;
+    }
+
+
+    /**
+     * Get's the value of this enumeration element.
+     *
+     * @return the value of the enumeration element
+     */
+    public final int getValue()
+    {
+        return this.value;
     }
 
 

Modified: directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TypeClass.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TypeClass.java?rev=289141&r1=289140&r2=289141&view=diff
==============================================================================
--- directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TypeClass.java (original)
+++ directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/TypeClass.java Wed Sep 14 21:15:15 2005
@@ -17,13 +17,6 @@
 package org.apache.asn1.ber ;
 
 
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang.enum.EnumUtils;
-import org.apache.commons.lang.enum.ValuedEnum;
-
-
 /**
  * Type safe enum for an ASN.1 type class.  This can be take one of the 
  * following four values: 
@@ -38,7 +31,7 @@
  * Apache Directory Project</a>
  * @version $Rev$
  */
-public class TypeClass extends ValuedEnum
+public class TypeClass
 {
     /** value for the universal type class */
     public static final int UNIVERSAL_VAL = 0 ;
@@ -62,7 +55,12 @@
     public static final TypeClass PRIVATE = 
         new TypeClass( "PRIVATE", PRIVATE_VAL ) ;
 
-    
+    /** the name of this enumeration element */
+    private final String name;
+    /** the value of this enumeration element */
+    private final int value;
+
+
     /**
      * Private constructor so no other instances can be created other than the
      * public static constants in this class.
@@ -72,10 +70,33 @@
      */
     private TypeClass( final String name, final int value )
     {
-        super( name, value ) ;
+        this.name = name;
+        this.value = value;
     }
-    
-    
+
+
+    /**
+     * Get's the name of this enumeration element.
+     *
+     * @return the name of the enumeration element
+     */
+    public final String getName()
+    {
+        return this.name;
+    }
+
+
+    /**
+     * Get's the value of this enumeration element.
+     *
+     * @return the value of the enumeration element
+     */
+    public final int getValue()
+    {
+        return this.value;
+    }
+
+
     /**
      * Gets the enumeration type for the type class regardless of case.
      * 
@@ -128,28 +149,6 @@
     }
     
     
-    /**
-     * Gets a List of the enumerations for ASN.1 type classes.
-     * 
-     * @return the List of enumerations possible for ASN.1 type classes
-     */
-    public static List list()
-    {
-        return EnumUtils.getEnumList( TypeClass.class ) ;
-    }
-    
-    
-    /**
-     * Gets the Map of TypeClass objects by name using the TypeClass class.
-     * 
-     * @return the Map by name of TypeClass
-     */
-    public static Map map()
-    {
-        return EnumUtils.getEnumMap( TypeClass.class ) ;
-    }
-
-
     /**
      * Gets the ASN.1 type's class using a TLV tag.
      * 

Modified: directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/primitives/UniversalTag.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/primitives/UniversalTag.java?rev=289141&r1=289140&r2=289141&view=diff
==============================================================================
--- directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/primitives/UniversalTag.java (original)
+++ directory/asn1/trunk/ber/src/java/org/apache/asn1/ber/primitives/UniversalTag.java Wed Sep 14 21:15:15 2005
@@ -17,11 +17,6 @@
 package org.apache.asn1.ber.primitives ;
 
 
-import java.util.Map ;
-import java.util.List ;
-
-import org.apache.commons.lang.enum.EnumUtils ;
-
 import org.apache.asn1.ber.TagEnum ;
 
 
@@ -339,29 +334,6 @@
     // -----------------------------------------------------------------------
     // Members
     // -----------------------------------------------------------------------
-
-
-    /**
-     * Gets a List of the enumerations for ASN.1 UNIVERSAL type tags.
-     * 
-     * @return the List of enumerations possible for ASN.1 UNIVERSAL type tags
-     */
-    public static List list()
-    {
-        return EnumUtils.getEnumList( UniversalTag.class ) ;
-    }
-    
-    
-    /**
-     * Gets the Map of UniversalTag objects by name using the UniversalTag 
-     * class.
-     * 
-     * @return the Map by name of UniversalTag
-     */
-    public static Map map()
-    {
-        return EnumUtils.getEnumMap( UniversalTag.class ) ;
-    }
 
 
     /**

Modified: directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BERDecoderStateTest.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BERDecoderStateTest.java?rev=289141&r1=289140&r2=289141&view=diff
==============================================================================
--- directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BERDecoderStateTest.java (original)
+++ directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/BERDecoderStateTest.java Wed Sep 14 21:15:15 2005
@@ -17,11 +17,7 @@
 package org.apache.asn1.ber ;
 
 
-import java.util.List;
-import java.util.Map;
-
 import junit.framework.TestCase ;
-import org.apache.asn1.ber.BERDecoderState;
 
 
 /**
@@ -127,26 +123,6 @@
         {
             assertNotNull( t ) ;
         }
-    }
-
-    public void testList()
-    {
-        List list = BERDecoderState.list() ;
-        assertNotNull( list ) ;
-        assertEquals( 3, list.size() ) ;
-        assertTrue( list.contains( BERDecoderState.LENGTH ) ) ;
-        assertTrue( list.contains( BERDecoderState.TAG ) ) ;
-        assertTrue( list.contains( BERDecoderState.VALUE ) ) ;
-    }
-
-    public void testMap()
-    {
-        Map map = BERDecoderState.map() ;
-        assertNotNull( map ) ;
-        assertEquals( 3, map.size() ) ;
-        assertTrue( map.containsKey( BERDecoderState.VALUE.getName() ) ) ;
-        assertTrue( map.containsKey( BERDecoderState.LENGTH.getName() ) ) ;
-        assertTrue( map.containsKey( BERDecoderState.TAG.getName() ) ) ;
     }
 
     /*

Modified: directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/TypeClassTest.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/TypeClassTest.java?rev=289141&r1=289140&r2=289141&view=diff
==============================================================================
--- directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/TypeClassTest.java (original)
+++ directory/asn1/trunk/ber/src/test/org/apache/asn1/ber/TypeClassTest.java Wed Sep 14 21:15:15 2005
@@ -17,11 +17,7 @@
 package org.apache.asn1.ber ;
 
 
-import java.util.List;
-import java.util.Map;
-
 import junit.framework.TestCase ;
-import org.apache.asn1.ber.TypeClass;
 
 
 /**
@@ -96,28 +92,6 @@
         { 
             assertNotNull( t ) ;
         }
-    }
-
-    public void testList()
-    {
-        List list = TypeClass.list() ;
-        assertNotNull( list ) ;
-        assertEquals( 4, list.size() ) ;
-        assertTrue( list.contains( TypeClass.PRIVATE ) ) ;
-        assertTrue( list.contains( TypeClass.UNIVERSAL ) ) ;
-        assertTrue( list.contains( TypeClass.APPLICATION ) ) ;
-        assertTrue( list.contains( TypeClass.CONTEXT_SPECIFIC ) ) ;
-    }
-
-    public void testMap()
-    {
-        Map map = TypeClass.map() ;
-        assertNotNull( map ) ;
-        assertEquals( 4, map.size() ) ;
-        assertTrue( map.containsKey( TypeClass.PRIVATE.getName() ) ) ;
-        assertTrue( map.containsKey( TypeClass.UNIVERSAL.getName() ) ) ;
-        assertTrue( map.containsKey( TypeClass.APPLICATION.getName() ) ) ;
-        assertTrue( map.containsKey( TypeClass.CONTEXT_SPECIFIC.getName() ) ) ;
     }
 
     /*