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 2004/10/27 5:31:55
    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.java.Type;
    13  import org.asyrinx.joey.gen.model.java.TypeCategory;
    14
    15  /***
    16   * @author takeshi
    17   */
    18  public abstract class EmbeddedClass implements Type {
    19
    20      private static final Map nameToType = new HashMap();
    21
    22      public static EmbeddedClass get(String name) {
    23          return (EmbeddedClass) nameToType.get(name);
    24      }
    25
    26      /***
    27       *
    28       */
    29      publicEmbeddedClass(String packageName, String className, TypeCategory category) {/package-summary.html">ong> EmbeddedClass(String packageName, String className, TypeCategory category) {
    30          this(packageName, className, category, false);
    31      }
    32
    33      /***
    34       *
    35       */
    36      publicEmbeddedClass(String packageName, String className, TypeCategory category, boolean meaningNumber) {/package-summary.html">ong> EmbeddedClass(String packageName, String className, TypeCategory category, boolean meaningNumber) {
    37          super();
    38          this.packageName = packageName;
    39          this.className = className;
    40          this.category = category;
    41          nameToType.put(className, this);
    42      }
    43
    44      privateong> final String packageName;
    45
    46      private final String className;
    47
    48      private final TypeCategory category;
    49
    50      /*
    51       * (non-Javadoc)
    52       *
    53       * @see org.asyrinx.joey.gen.model.java.Type#getCategory()
    54       */
    55      public TypeCategory getCategory() {
    56          return this.category;
    57      }
    58
    59      /*
    60       * (non-Javadoc)
    61       *
    62       * @see org.asyrinx.joey.gen.model.java.Type#getFqn()
    63       */
    64      public String getFqn() {
    65          return getPackage() + PACKAGE_SEPARATER + getName();
    66      }
    67
    68      /*
    69       * (non-Javadoc)
    70       *
    71       * @see org.asyrinx.joey.gen.model.java.Type#getPackage()
    72       */
    73      public String getPackage() {
    74          return getPackageName();
    75      }
    76
    77      /*
    78       * (non-Javadoc)
    79       *
    80       * @see org.asyrinx.joey.gen.model.java.Type#getName()
    81       */
    82      public String getName() {
    83          return this.className;
    84      }
    85
    86      /*
    87       * (non-Javadoc)
    88       *
    89       * @see org.asyrinx.joey.gen.model.java.Type#isPrimitive()
    90       */
    91      public boolean isPrimitive() {
    92          return false;
    93      }
    94
    95      /*
    96       * (non-Javadoc)
    97       *
    98       * @see org.asyrinx.joey.gen.model.java.Type#toClass()
    99       */
    100     public Type toClass() {
    101         return this;
    102     }
    103
    104     /*
    105      * (non-Javadoc)
    106      *
    107      * @see org.asyrinx.joey.gen.model.java.Type#toPrimitive()
    108      */
    109     public Type toPrimitive() {
    110         return null;
    111     }
    112
    113     /***
    114      * @return Returns the className.
    115      */
    116     public String getClassName() {
    117         return className;
    118     }
    119
    120     /***
    121      * @return Returns the packageName.
    122      */
    123     public String getPackageName() {
    124         return</strong> packageName;
    125     }
    126
    127     /*
    128      * (non-Javadoc)
    129      *
    130      * @see org.asyrinx.joey.gen.model.java.Type#isNumber()
    131      */
    132     public boolean isNumber() {
    133         return getCategory() == TypeCategory.NUMBER;
    134     }
    135
    136 }