1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 import com.sun.org.apache.bcel.internal.Constants; 57 58 64 public final class BasicType extends Type { 65 71 BasicType(byte type) { 72 super(type, Constants.SHORT_TYPE_NAMES[type]); 73 74 if((type < Constants.T_BOOLEAN) || (type > Constants.T_VOID)) 75 throw new ClassGenException("Invalid type: " + type); 76 } 77 78 public static final BasicType getType(byte type) { 79 switch(type) { 80 case Constants.T_VOID: return VOID; 81 case Constants.T_BOOLEAN: return BOOLEAN; 82 case Constants.T_BYTE: return BYTE; 83 case Constants.T_SHORT: return SHORT; 84 case Constants.T_CHAR: return CHAR; 85 case Constants.T_INT: return INT; 86 case Constants.T_LONG: return LONG; 87 case Constants.T_DOUBLE: return DOUBLE; 88 case Constants.T_FLOAT: return FLOAT; 89 90 default: 91 throw new ClassGenException("Invalid type: " + type); 92 } 93 } 94 95 97 public boolean equals(Object type) { 98 return (type instanceof BasicType)? 99 ((BasicType)type).type == this.type : false; 100 } 101 } 102 | Popular Tags |