Index: src/main/java/org/exolab/castor/builder/factory/EnumerationFactory.java
===================================================================
--- src/main/java/org/exolab/castor/builder/factory/EnumerationFactory.java	(revision 8361)
+++ src/main/java/org/exolab/castor/builder/factory/EnumerationFactory.java	(working copy)
@@ -32,8 +32,10 @@
 import org.exolab.castor.builder.types.XSType;
 import org.exolab.castor.xml.schema.Facet;
 import org.exolab.castor.xml.schema.SimpleType;
+import org.exolab.javasource.JAnnotationType;
 import org.exolab.javasource.JArrayType;
 import org.exolab.javasource.JClass;
+import org.exolab.javasource.JCollectionType;
 import org.exolab.javasource.JConstructor;
 import org.exolab.javasource.JDocComment;
 import org.exolab.javasource.JEnum;
@@ -286,14 +288,37 @@
             state.getSGStateInfo().getSourceGenerator().getAnnotationBuilders();
         
         JEnum jEnum = (JEnum) state.getJClass();
-
+        
+        jEnum.removeInterface("java.io.Serializable");
+        jEnum.removeAnnotation(new JAnnotationType("SuppressWarnings"));
+        
         // add value field
-        JField jField = new JField(new JClass("java.lang.String"), "value");
+        JField valueField = new JField(new JClass("java.lang.String"), "value");
         JModifiers modifiers = new JModifiers();
         modifiers.setFinal(true);
         modifiers.makePrivate();
-        jField.setModifiers(modifiers);
-        jEnum.addField(jField);
+        valueField.setModifiers(modifiers);
+        jEnum.addField(valueField);
+
+        // add enumConstants field
+        JField enumConstantsField = new JField(new JClass("java.util.Map<java.lang.String, " + jEnum.getLocalName() + ">"), "enumConstants");
+        modifiers = new JModifiers();
+        modifiers.setFinal(true);
+        modifiers.makePrivate();
+        modifiers.setStatic(true);
+        enumConstantsField.setModifiers(modifiers);
+        enumConstantsField.setInitString("new java.util.HashMap<java.lang.String, " + jEnum.getLocalName() + ">();");
+        jEnum.addField(enumConstantsField);
+        
+        // add static initialization of enumConstants field
+        JSourceCode sourceCode = jEnum.getStaticInitializationCode();
+        sourceCode.add("for (" + jEnum.getLocalName() + " c: " 
+                + jEnum.getLocalName() + ".values()) {");
+        sourceCode.indent();
+        sourceCode.indent();
+        sourceCode.add(jEnum.getLocalName() + "." + enumConstantsField.getName() + ".put(c." + valueField.getName() + ", c);");
+        sourceCode.unindent();
+        sourceCode.add("}");
 
         JMethod valueMethod = new JMethod("value", new JClass("java.lang.String"), 
                 "the value of this constant");
@@ -302,17 +327,13 @@
 
         JMethod fromValueMethod = new JMethod("fromValue", jEnum, "the constant for this value");
         fromValueMethod.addParameter(new JParameter(new JClass("java.lang.String"), "value"));
-        JSourceCode sourceCode = new JSourceCode();
-        sourceCode.add("for (" + jEnum.getLocalName() + " c: " 
-                + jEnum.getLocalName() + ".values()) {");
-        sourceCode.indent();
-        sourceCode.add("if (c.value.equals(value)) {");
+        sourceCode = new JSourceCode();
+        sourceCode.add(jEnum.getLocalName() + " c = " + jEnum.getLocalName() + "." + enumConstantsField.getName() + ".get(value);");
+        sourceCode.add("if (c != null) {");
         sourceCode.indent();
         sourceCode.add("return c;");
         sourceCode.unindent();
         sourceCode.add("}");
-        sourceCode.unindent();
-        sourceCode.add("}");
         sourceCode.add("throw new IllegalArgumentException(value);");
         fromValueMethod.setSourceCode(sourceCode);
         modifiers = new JModifiers();
Index: src/main/java/org/exolab/javasource/JStructure.java
===================================================================
--- src/main/java/org/exolab/javasource/JStructure.java	(revision 8361)
+++ src/main/java/org/exolab/javasource/JStructure.java	(working copy)
@@ -395,6 +395,19 @@
         }
     }
 
+    /**
+     * Removes the given interface from the list of interfaces this JStructure
+     * has.
+     *
+     * @param interfaceName The name of the interface to be removed.
+     * @return true if JStructure implemented the interface and it was removed,
+     *         false otherwise.
+     */
+    public final boolean removeInterface(final String interfaceName) {
+        return _interfaces.remove(interfaceName);
+    }
+
+
     //--------------------------------------------------------------------------
 
     /**

