Here are the examples of the java api class com.sun.org.apache.xalan.internal.xsltc.compiler.util.NamedMethodGenerator taken from open source projects.
1. Mode#compileNamedTemplate()
Project: openjdk
File: Mode.java
File: Mode.java
private void compileNamedTemplate(Template template, ClassGenerator classGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = new InstructionList(); String methodName = Util.escape(template.getName().toString()); int numParams = 0; if (template.isSimpleNamedTemplate()) { Vector parameters = template.getParameters(); numParams = parameters.size(); } // Initialize the types and names arrays for the NamedMethodGenerator. com.sun.org.apache.bcel.internal.generic.Type[] types = new com.sun.org.apache.bcel.internal.generic.Type[4 + numParams]; String[] names = new String[4 + numParams]; types[0] = Util.getJCRefType(DOM_INTF_SIG); types[1] = Util.getJCRefType(NODE_ITERATOR_SIG); types[2] = Util.getJCRefType(TRANSLET_OUTPUT_SIG); types[3] = com.sun.org.apache.bcel.internal.generic.Type.INT; names[0] = DOCUMENT_PNAME; names[1] = ITERATOR_PNAME; names[2] = TRANSLET_OUTPUT_PNAME; names[3] = NODE_PNAME; // template. for (int i = 4; i < 4 + numParams; i++) { types[i] = Util.getJCRefType(OBJECT_SIG); names[i] = "param" + String.valueOf(i - 4); } NamedMethodGenerator methodGen = new NamedMethodGenerator(ACC_PUBLIC, com.sun.org.apache.bcel.internal.generic.Type.VOID, types, names, methodName, getClassName(), il, cpg); il.append(template.compile(classGen, methodGen)); il.append(RETURN); classGen.addMethod(methodGen); }