Examples of ConstantInteger


Examples of org.aspectj.apache.bcel.classfile.ConstantInteger

  // Whatever kind of value it is, return it as a string
  @Override
  public String stringifyValue() {
    switch (type) {
    case PRIMITIVE_INT:
      ConstantInteger c = (ConstantInteger) cpool.getConstant(idx);
      return Integer.toString(c.getValue());
    case PRIMITIVE_LONG:
      ConstantLong j = (ConstantLong) cpool.getConstant(idx);
      return Long.toString(j.getValue());
    case PRIMITIVE_DOUBLE:
      ConstantDouble d = (ConstantDouble) cpool.getConstant(idx);
      return d.getValue().toString();
    case PRIMITIVE_FLOAT:
      ConstantFloat f = (ConstantFloat) cpool.getConstant(idx);
      return Float.toString(f.getValue());
    case PRIMITIVE_SHORT:
      ConstantInteger s = (ConstantInteger) cpool.getConstant(idx);
      return Integer.toString(s.getValue());
    case PRIMITIVE_BYTE:
      ConstantInteger b = (ConstantInteger) cpool.getConstant(idx);
      return Integer.toString(b.getValue());
    case PRIMITIVE_CHAR:
      ConstantInteger ch = (ConstantInteger) cpool.getConstant(idx);
      return new Character((char) ch.getIntValue()).toString();
    case PRIMITIVE_BOOLEAN:
      ConstantInteger bo = (ConstantInteger) cpool.getConstant(idx);
      if (bo.getValue() == 0)
        return "false";
      else
        return "true";
    case STRING:
      ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(idx);
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.ConstantInteger

    }
   
    public int getValueInt() {
      if (type != PRIMITIVE_INT)
        throw new RuntimeException("Dont call getValueString() on a non STRING ElementValue");
    ConstantInteger c = (ConstantInteger)cpGen.getConstant(idx);
    return c.getBytes();
    }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.ConstantInteger

   
    // Whatever kind of value it is, return it as a string
    public String stringifyValue() {
      switch (type) {
        case PRIMITIVE_INT:
          ConstantInteger c = (ConstantInteger)cpGen.getConstant(idx);
        return Integer.toString(c.getBytes());
        case PRIMITIVE_LONG:
          ConstantLong j = (ConstantLong)cpGen.getConstant(idx);
        return Long.toString(j.getBytes());
        case PRIMITIVE_DOUBLE:
          ConstantDouble d = (ConstantDouble)cpGen.getConstant(idx);
        return Double.toString(d.getBytes());
        case PRIMITIVE_FLOAT:
          ConstantFloat f = (ConstantFloat)cpGen.getConstant(idx);
        return Float.toString(f.getBytes());
        case PRIMITIVE_SHORT:
        ConstantInteger s = (ConstantInteger)cpGen.getConstant(idx);
        return Integer.toString(s.getBytes());
        case PRIMITIVE_BYTE:
        ConstantInteger b = (ConstantInteger)cpGen.getConstant(idx);
        return Integer.toString(b.getBytes());
        case PRIMITIVE_CHAR:
        ConstantInteger ch = (ConstantInteger)cpGen.getConstant(idx);
        return Integer.toString(ch.getBytes());
        case PRIMITIVE_BOOLEAN:
        ConstantInteger bo = (ConstantInteger)cpGen.getConstant(idx);
        if (bo.getBytes() == 0) return "false";
        if (bo.getBytes() != 0) return "true";
        case STRING:
        ConstantUtf8 cu8 = (ConstantUtf8)cpGen.getConstant(idx);
        return cu8.getBytes();
       
       default:
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.ConstantInteger

    }
   
    public int getValueInt() {
      if (type != PRIMITIVE_INT)
        throw new RuntimeException("Dont call getValueString() on a non STRING ElementValue");
    ConstantInteger c = (ConstantInteger)cpool.getConstant(idx,Constants.CONSTANT_Integer);
    return c.getBytes();
    }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.ConstantInteger

    }
   
    public byte getValueByte() {
      if (type != PRIMITIVE_BYTE)
        throw new RuntimeException("Dont call getValueByte() on a non BYTE ElementValue");
    ConstantInteger c = (ConstantInteger)cpool.getConstant(idx,Constants.CONSTANT_Integer);
    return (byte)c.getBytes();
    }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.ConstantInteger

    }
   
    public char getValueChar() {
      if (type != PRIMITIVE_CHAR)
        throw new RuntimeException("Dont call getValueChar() on a non CHAR ElementValue");
    ConstantInteger c = (ConstantInteger)cpool.getConstant(idx,Constants.CONSTANT_Integer);
    return (char)c.getBytes();
    }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.ConstantInteger

    }
   
    public boolean getValueBoolean() {
      if (type != PRIMITIVE_BOOLEAN)
        throw new RuntimeException("Dont call getValueBoolean() on a non BOOLEAN ElementValue");
      ConstantInteger bo = (ConstantInteger)cpool.getConstant(idx);
      return (bo.getBytes()!=0);
    }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.ConstantInteger

    }
   
    public short getValueShort() {
      if (type != PRIMITIVE_SHORT)
        throw new RuntimeException("Dont call getValueShort() on a non SHORT ElementValue");
      ConstantInteger s = (ConstantInteger)cpool.getConstant(idx);
      return (short)s.getBytes();
    }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.ConstantInteger

   
    // Whatever kind of value it is, return it as a string
    public String stringifyValue() {
      switch (type) {
        case PRIMITIVE_INT:
          ConstantInteger c = (ConstantInteger)cpool.getConstant(idx,Constants.CONSTANT_Integer);
        return Integer.toString(c.getBytes());
        case PRIMITIVE_LONG:
          ConstantLong j = (ConstantLong)cpool.getConstant(idx,Constants.CONSTANT_Long);
        return Long.toString(j.getBytes());
        case PRIMITIVE_DOUBLE:
          ConstantDouble d = (ConstantDouble)cpool.getConstant(idx,Constants.CONSTANT_Double);
        return Double.toString(d.getBytes());
        case PRIMITIVE_FLOAT:
          ConstantFloat f = (ConstantFloat)cpool.getConstant(idx,Constants.CONSTANT_Float);
        return Float.toString(f.getBytes());
        case PRIMITIVE_SHORT:
        ConstantInteger s = (ConstantInteger)cpool.getConstant(idx,Constants.CONSTANT_Integer);
        return Integer.toString(s.getBytes());
        case PRIMITIVE_BYTE:
        ConstantInteger b = (ConstantInteger)cpool.getConstant(idx,Constants.CONSTANT_Integer);
        return Integer.toString(b.getBytes());
        case PRIMITIVE_CHAR:
        ConstantInteger ch = (ConstantInteger)cpool.getConstant(idx,Constants.CONSTANT_Integer);
        return Integer.toString(ch.getBytes());
        case PRIMITIVE_BOOLEAN:
        ConstantInteger bo = (ConstantInteger)cpool.getConstant(idx,Constants.CONSTANT_Integer);
        if (bo.getBytes() == 0) return "false";
        if (bo.getBytes() != 0) return "true";
        case STRING:
        ConstantUtf8 cu8 = (ConstantUtf8)cpool.getConstant(idx,Constants.CONSTANT_Utf8);
        return cu8.getBytes();
       
       default:
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.ConstantInteger

   * @return index on success, -1 otherwise
   */
  public int lookupInteger(int n) {
    for(int i=1; i < index; i++) {
      if(constants[i] instanceof ConstantInteger) {
  ConstantInteger c = (ConstantInteger)constants[i];

  if(c.getBytes() == n)
    return i;
      }
    }

    return -1;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.