/** Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new CHECKCAST(cpg.addClass(INTEGER_CLASS))); final int index = cpg.addMethodref(INTEGER_CLASS, INT_VALUE, INT_VALUE_SIG); il.append(new INVOKEVIRTUAL(index)); }
/** * Expects an integer on the stack and pushes a boxed integer. Boxed integers are represented by * an instance of <code>java.lang.Integer</code>. * * @see com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new NEW(cpg.addClass(INTEGER_CLASS))); il.append(DUP_X1); il.append(SWAP); il.append(new INVOKESPECIAL(cpg.addMethodref(INTEGER_CLASS, "<init>", "(I)V"))); }
/** * Expects an integer on the stack and pushes its string value by calling <code> * Integer.toString(int i)</code>. * * @see com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new INVOKESTATIC(cpg.addMethodref(INTEGER_CLASS, "toString", "(I)" + STRING_SIG))); }
/** * Translates a void into a string by pushing the empty string ''. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(classGen.getConstantPool(), "")); }