下面列出了org.objectweb.asm.ClassWriter#newConst ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
}
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');
}
}