本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.compiler.util.NamedMethodGenerator类的典型用法代码示例。如果您正苦于以下问题:Java NamedMethodGenerator类的具体用法?Java NamedMethodGenerator怎么用?Java NamedMethodGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NamedMethodGenerator类属于com.sun.org.apache.xalan.internal.xsltc.compiler.util包,在下文中一共展示了NamedMethodGenerator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: compileNamedTemplate
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NamedMethodGenerator; //导入依赖的package包/类
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;
// For simple named templates, the signature of the generated method
// is not fixed. It depends on the number of parameters declared in the
// 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);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:Mode.java
示例2: translate
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NamedMethodGenerator; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
if (_disabled) return;
// bug fix #4433133, add a call to named template from applyTemplates
String className = classGen.getClassName();
if (_compiled && isNamed()){
String methodName = Util.escape(_name.toString());
il.append(classGen.loadTranslet());
il.append(methodGen.loadDOM());
il.append(methodGen.loadIterator());
il.append(methodGen.loadHandler());
il.append(methodGen.loadCurrentNode());
il.append(new INVOKEVIRTUAL(cpg.addMethodref(className,
methodName,
"("
+ DOM_INTF_SIG
+ NODE_ITERATOR_SIG
+ TRANSLET_OUTPUT_SIG
+ "I)V")));
return;
}
if (_compiled) return;
_compiled = true;
// %OPT% Special handling for simple named templates.
if (_isSimpleNamedTemplate && methodGen instanceof NamedMethodGenerator) {
int numParams = _parameters.size();
NamedMethodGenerator namedMethodGen = (NamedMethodGenerator)methodGen;
// Update load/store instructions to access Params from the stack
for (int i = 0; i < numParams; i++) {
Param param = (Param)_parameters.elementAt(i);
param.setLoadInstruction(namedMethodGen.loadParameter(i));
param.setStoreInstruction(namedMethodGen.storeParameter(i));
}
}
translateContents(classGen, methodGen);
il.setPositions(true);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:Template.java
注:本文中的com.sun.org.apache.xalan.internal.xsltc.compiler.util.NamedMethodGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论