jaxp/src/com/sun/org/apache/bcel/internal/generic/BasicType.java

Print this page




  80 
  81   public static final BasicType getType(byte type) {
  82     switch(type) {
  83     case Constants.T_VOID:    return VOID;
  84     case Constants.T_BOOLEAN: return BOOLEAN;
  85     case Constants.T_BYTE:    return BYTE;
  86     case Constants.T_SHORT:   return SHORT;
  87     case Constants.T_CHAR:    return CHAR;
  88     case Constants.T_INT:     return INT;
  89     case Constants.T_LONG:    return LONG;
  90     case Constants.T_DOUBLE:  return DOUBLE;
  91     case Constants.T_FLOAT:   return FLOAT;
  92 
  93     default:
  94       throw new ClassGenException("Invalid type: " + type);
  95     }
  96   }
  97 
  98   /** @return true if both type objects refer to the same type
  99    */

 100   public boolean equals(Object type) {
 101     return (type instanceof BasicType)?
 102       ((BasicType)type).type == this.type : false;
 103   }





 104 }


  80 
  81   public static final BasicType getType(byte type) {
  82     switch(type) {
  83     case Constants.T_VOID:    return VOID;
  84     case Constants.T_BOOLEAN: return BOOLEAN;
  85     case Constants.T_BYTE:    return BYTE;
  86     case Constants.T_SHORT:   return SHORT;
  87     case Constants.T_CHAR:    return CHAR;
  88     case Constants.T_INT:     return INT;
  89     case Constants.T_LONG:    return LONG;
  90     case Constants.T_DOUBLE:  return DOUBLE;
  91     case Constants.T_FLOAT:   return FLOAT;
  92 
  93     default:
  94       throw new ClassGenException("Invalid type: " + type);
  95     }
  96   }
  97 
  98   /** @return true if both type objects refer to the same type
  99    */
 100   @Override
 101   public boolean equals(Object type) {
 102     return (type instanceof BasicType)?
 103       ((BasicType)type).type == this.type : false;
 104   }
 105 
 106   @Override
 107   public int hashCode() {
 108       return type;
 109   }
 110 }