View Javadoc

    1   /*
    2    * joey-gen and its relative products are published under the terms
    3    * of the Apache Software License.
    4    *
    5    * Created on 2005/02/25 20:24:48
    6    */
    7   package org.asyrinx.joey.gen.model.java.classes;
    8
    9   import java.util.HashMap;
    10  import java.util.Map;
    11
    12  import org.asyrinx.joey.gen.model.EnumerationEntry;
    13  import org.asyrinx.joey.gen.model.java.JavaEnumeration;
    14  import org.asyrinx.joey.gen.model.rdb.RdbEnumeration;
    15
    16  /***
    17   * @author takeshi
    18   */
    19  public class JoeyRuntimeClass {
    20
    21      private static final Map rdbEnums = new HashMap();
    22
    23      private static final Map javaEnums = new HashMap();
    24
    25      private static RdbEnumeration createRdbBooleanEnum() {
    26          final RdbEnumeration result = new RdbEnumeration();
    27          result.setName("BooleanEnum");
    28          result.setValueType("INTEGER");
    29          result.setLabel("BOOLEAN");
    30          new EnumerationEntry(result, "0", "false", "false");
    31          new EnumerationEntry(result, "1", "true", "true");
    32          final String key = result.getName();
    33          rdbEnums.put(key, result);
    34          return result;
    35      }
    36
    37      private static JavaEnumeration createJavaBooleanEnum() {
    38          final JavaEnumeration result = new JavaEnumeration();
    39          result.setName("BooleanEnum");
    40          result.setPackageName("org.asyrinx.brownie.core.lang.enum.util");
    41          result.setValueType("int");
    42          result.setValueTypeObj(PrimitiveType.INT);
    43          result.setLabel("BOOLEAN");
    44          result.setOriginal(RDB_BOOLEAN_ENUM);
    45          new EnumerationEntry(result, "0", "false", "false");
    46          new EnumerationEntry(result, "1", "true", "true");
    47          javaEnums.put(result.getName(), result);
    48          return result;
    49      }
    50
    51      public static RdbEnumeration getRdbEnum(String enumName) {
    52          return (RdbEnumeration) rdbEnums.get(enumName);
    53      }
    54
    55      public static JavaEnumeration getJavaEnum(String enumName) {
    56          return (JavaEnumeration) javaEnums.get(enumName);
    57      }
    58
    59      public static final RdbEnumeration RDB_BOOLEAN_ENUM = createRdbBooleanEnum();
    60
    61      public static final JavaEnumeration JAVA_BOOLEAN_ENUM = createJavaBooleanEnum();
    62
    63  }