Assuming parameterType
is of type Class
OR of type String
containing a type descriptor (like "I"
or "Ljava/lang/String;"
), then:
import org.objectweb.asm.Type;
...
Type parameterAsmType = Type.getType(parameterType);
int opcode = parameterAsmType.getOpcode(Opcodes.ILOAD);
mv.visitVarInsn(opcode, 1);
Similarly for other opcodes. See the Type.getOpcode()
javadoc for details.