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/08/14 19:46:14
    6    */
    7   package org.asyrinx.joey.gen.model.java.classes;
    8
    9   import org.asyrinx.joey.gen.model.java.Type;
    10  import org.asyrinx.joey.gen.model.java.TypeCategory;
    11
    12  /***
    13   * @author akima
    14   */
    15  public abstract class PrimitiveType extends EmbeddedClass {
    16
    17      public static final String PACKAGE = "java.lang";
    18
    19      /***
    20       * @param className
    21       * @param category
    22       */
    23      public PrimitiveType(String className, TypeCategory category) {
    24          super(PACKAGE, className, category);
    25      }
    26
    27      /*
    28       * (non-Javadoc)
    29       *
    30       * @see org.asyrinx.joey.gen.model.java.Type#getFullName()
    31       */
    32      public String getFqn() {
    33          return getName();
    34      }
    35
    36      /*
    37       * (non-Javadoc)
    38       *
    39       * @see org.asyrinx.joey.gen.model.java.Type#getPackage()
    40       */
    41      public String getPackage() {
    42          return null;
    43      }
    44
    45      /*
    46       * (non-Javadoc)
    47       *
    48       * @see org.asyrinx.joey.gen.model.java.Type#isPrimitive()
    49       */
    50      public boolean isPrimitive() {
    51          return true;
    52      }
    53
    54      /*
    55       * (non-Javadoc)
    56       *
    57       * @see org.asyrinx.joey.gen.model.java.Type#toPrimitive()
    58       */
    59      public Type toPrimitive() {
    60          return this;
    61      }
    62
    63      public static final PrimitiveType BOOLEAN = new PrimitiveType("boolean", TypeCategory.BOOLEAN) {
    64          public Type toClass() {
    65              return PrimitiveWrapper.BOOLEAN;
    66          }
    67      };
    68
    69      public static final PrimitiveType CHAR = new PrimitiveType("char", TypeCategory.STRING) {
    70          public Type toClass() {
    71              return PrimitiveWrapper.CHARACTER;
    72          }
    73      };
    74
    75      public static final PrimitiveType BYTE = new PrimitiveType("byte", TypeCategory.NUMBER) {
    76          public Type toClass() {
    77              return PrimitiveWrapper.BYTE;
    78          }
    79      };
    80
    81      public static final PrimitiveType SHORT = new PrimitiveType("short", TypeCategory.NUMBER) {
    82          public Type toClass() {
    83              return PrimitiveWrapper.SHORT;
    84          }
    85      };
    86
    87      public static final PrimitiveType INT = new PrimitiveType("int", TypeCategory.NUMBER) {
    88          public Type toClass() {
    89              return PrimitiveWrapper.INTEGER;
    90          }
    91      };
    92
    93      public static final PrimitiveType LONG = new PrimitiveType("long", TypeCategory.NUMBER) {
    94          public Type toClass() {
    95              return PrimitiveWrapper.LONG;
    96          }
    97      };
    98
    99      public static final PrimitiveType FLOAT = new PrimitiveType("float", TypeCategory.NUMBER) {
    100         public Type toClass() {
    101             return PrimitiveWrapper.FLOAT;
    102         }
    103     };
    104
    105     public static final PrimitiveType DOUBLE = new PrimitiveType("double", TypeCategory.NUMBER) {
    106         public Type toClass() {
    107             return PrimitiveWrapper.DOUBLE;
    108         }
    109     };
    110
    111 }