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          super();
    31          this.packageName = packageName;
    32          this.className = className;
    33          this.category = category;
    34          nameToType.put(className, this);
    35      }
    36
    37      privateong> final String packageName;
    38
    39      private final String className;
    40
    41      private final TypeCategory category;
    42
    43      /*
    44       * (non-Javadoc)
    45       *
    46       * @see org.asyrinx.joey.gen.model.java.Type#getCategory()
    47       */
    48      public TypeCategory getCategory() {
    49          return this.category;
    50      }
    51
    52      /*
    53       * (non-Javadoc)
    54       *
    55       * @see org.asyrinx.joey.gen.model.java.Type#getFqn()
    56       */
    57      public String getFqn() {
    58          return getPackage() + PACKAGE_SEPARATER + getName();
    59      }
    60
    61      /*
    62       * (non-Javadoc)
    63       *
    64       * @see org.asyrinx.joey.gen.model.java.Type#getPackage()
    65       */
    66      public String getPackage() {
    67          return getPackageName();
    68      }
    69
    70      /*
    71       * (non-Javadoc)
    72       *
    73       * @see org.asyrinx.joey.gen.model.java.Type#getName()
    74       */
    75      public String getName() {
    76          return this.className;
    77      }
    78
    79      /*
    80       * (non-Javadoc)
    81       *
    82       * @see org.asyrinx.joey.gen.model.java.Type#isPrimitive()
    83       */
    84      public boolean isPrimitive() {
    85          return false;
    86      }
    87
    88      /*
    89       * (non-Javadoc)
    90       *
    91       * @see org.asyrinx.joey.gen.model.java.Type#toClass()
    92       */
    93      public Type toClass() {
    94          return this;
    95      }
    96
    97      /*
    98       * (non-Javadoc)
    99       *
    100      * @see org.asyrinx.joey.gen.model.java.Type#toPrimitive()
    101      */
    102     public Type toPrimitive() {
    103         return null;
    104     }
    105
    106     /***
    107      * @return Returns the className.
    108      */
    109     public String getClassName() {
    110         return className;
    111     }
    112
    113     /***
    114      * @return Returns the packageName.
    115      */
    116     public String getPackageName() {
    117         return</strong> packageName;
    118     }
    119
    120     /*
    121      * (non-Javadoc)
    122      *
    123      * @see org.asyrinx.joey.gen.model.java.Type#isNumber()
    124      */
    125     public boolean isNumber() {
    126         return getCategory() == TypeCategory.NUMBER;
    127     }
    128
    129 }