Java Code Examples for org.objectweb.asm.ClassWriter#newMethod()

The following examples show how to use org.objectweb.asm.ClassWriter#newMethod() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Constant.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
public
void write(final ClassWriter cw) {
    switch (type) {
        case 'I':
            cw.newConst(new Integer(intVal)); // NOPMD by xlv
            break;
        case 'J':
            cw.newConst(new Long(longVal));
            break;
        case 'F':
            cw.newConst(new Float(floatVal));
            break;
        case 'D':
            cw.newConst(new Double(doubleVal));
            break;
        case 'S':
            cw.newConst(strVal1);
            break;
        case 's':
            cw.newUTF8(strVal1);
            break;
        case 'C':
            cw.newClass(strVal1);
            break;
        case 'T':
            cw.newNameType(strVal1, strVal2);
            break;
        case 'G':
            cw.newField(strVal1, strVal2, strVal3);
            break;
        case 'M':
            cw.newMethod(strVal1, strVal2, strVal3, false);
            break;
        case 'N':
            cw.newMethod(strVal1, strVal2, strVal3, true);
            break;
    }
}
 
Example 2
Source File: Constant.java    From JByteMod-Beta with GNU General Public License v2.0 4 votes vote down vote up
void write(final ClassWriter cw) {
  switch (type) {
  case 'I':
    cw.newConst(intVal);
    break;
  case 'J':
    cw.newConst(longVal);
    break;
  case 'F':
    cw.newConst(floatVal);
    break;
  case 'D':
    cw.newConst(doubleVal);
    break;
  case 'S':
    cw.newConst(strVal1);
    break;
  case 's':
    cw.newUTF8(strVal1);
    break;
  case 'C':
    cw.newClass(strVal1);
    break;
  case 'T':
    cw.newNameType(strVal1, strVal2);
    break;
  case 'G':
    cw.newField(strVal1, strVal2, (String) objVal3);
    break;
  case 'M':
    cw.newMethod(strVal1, strVal2, (String) objVal3, false);
    break;
  case 'N':
    cw.newMethod(strVal1, strVal2, (String) objVal3, true);
    break;
  case 'y':
    cw.newInvokeDynamic(strVal1, strVal2, (Handle) objVal3, objVals);
    break;
  case 't':
    cw.newMethodType(strVal1);
    break;
  default: // 'h' ... 'r' : handle
    cw.newHandle(type - 'h' + 1 - ((type >= 'q') ? 4 : 0), strVal1, strVal2, (String) objVal3, type >= 'p');
  }
}