Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.InstructionList


     */
    public void translateFrom(ClassGenerator classGen,
  MethodGenerator methodGen, Class clazz)
    {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();

  if (clazz.getName().equals("java.lang.String")) {
      // same internal representation, convert null to ""
      il.append(DUP);
      final BranchHandle ifNonNull = il.append(new IFNONNULL(null));
      il.append(POP);
      il.append(new PUSH(cpg, ""));
      ifNonNull.setTarget(il.append(NOP));
  }
  else {
      ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
          toString(), clazz.getName());
      classGen.getParser().reportError(Constants.FATAL, err);
View Full Code Here


     */
    public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
          StringType type) {
  final int current = methodGen.getLocalIndex("current");
  ConstantPoolGen cpg = classGen.getConstantPool();
  InstructionList il = methodGen.getInstructionList();

  il.append(new ILOAD(current));
  il.append(methodGen.loadDOM());
  final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS,
               "stringF",
               "("
               + OBJECT_SIG
               + NODE_SIG
               + DOM_INTF_SIG
               + ")" + STRING_SIG);
  il.append(new INVOKESTATIC(stringF));
    }
View Full Code Here

     * @see  org.apache.xalan.xsltc.compiler.util.Type#translateTo
     */
    public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
          RealType type) {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();

  il.append(methodGen.loadDOM());
  int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "numberF",
             "("
             + OBJECT_SIG
             + DOM_INTF_SIG
             + ")D");
  il.append(new INVOKESTATIC(index));
    }
View Full Code Here

     * @see  org.apache.xalan.xsltc.compiler.util.Type#translateTo
     */
    public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
          BooleanType type) {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();

  int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "booleanF",
             "("
             + OBJECT_SIG
             + ")Z");
  il.append(new INVOKESTATIC(index));
    }
View Full Code Here

     * @see  org.apache.xalan.xsltc.compiler.util.Type#translateTo
     */
    public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
          NodeSetType type) {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();
  int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNodeSet",
             "("
             + OBJECT_SIG
             + ")"
             + NODE_ITERATOR_SIG);
  il.append(new INVOKESTATIC(index));
 
  // Reset this iterator
  index = cpg.addInterfaceMethodref(NODE_ITERATOR, RESET, RESET_SIG);
  il.append(new INVOKEINTERFACE(index, 1));
    }
View Full Code Here

     * @see  org.apache.xalan.xsltc.compiler.util.Type#translateTo
     */
    public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
          ResultTreeType type) {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();
  int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToResultTree",
             "(" + OBJECT_SIG + ")" + DOM_INTF_SIG);
  il.append(new INVOKESTATIC(index));
    }
View Full Code Here

     * Translates a reference into the Java type denoted by <code>clazz</code>.
     */
    public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
          Class clazz) {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();
 
  if (clazz.getName().equals("java.lang.Object")) {
      il.append(NOP)
  }
  else if (clazz == Double.TYPE) {
      translateTo(classGen, methodGen, Type.Real);
  }
  else if (clazz.getName().equals("java.lang.String")) {
      translateTo(classGen, methodGen, Type.String);
  }
  else if (clazz.getName().equals("org.w3c.dom.Node")) {
      int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNode",
                 "("
                 + OBJECT_SIG
                 + DOM_INTF_SIG
                 + ")"
                 + "Lorg/w3c/dom/Node;");
      il.append(methodGen.loadDOM());
      il.append(new INVOKESTATIC(index));
  }
  else if (clazz.getName().equals("org.w3c.dom.NodeList")) {
      int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNodeList",
                 "("
                 + OBJECT_SIG
                 + DOM_INTF_SIG
                 + ")"
                 + "Lorg/w3c/dom/NodeList;");
      il.append(methodGen.loadDOM());
      il.append(new INVOKESTATIC(index));
  }
  else if (clazz.getName().equals("org.apache.xalan.xsltc.DOM")) {
      translateTo(classGen, methodGen, Type.ResultTree);
  }
  else {
View Full Code Here

     * @see org.apache.xalan.xsltc.compiler.util.Type#translateToDesynthesized
     */
    public FlowList translateToDesynthesized(ClassGenerator classGen,
               MethodGenerator methodGen,
               BooleanType type) {
  InstructionList il = methodGen.getInstructionList();
  translateTo(classGen, methodGen, type);
  return new FlowList(il.append(new IFEQ(null)));
    }
View Full Code Here

     *
     * @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(), ""));
    }
View Full Code Here

    public AttributeSetMethodGenerator(String methodName, ClassGen classGen) {
  super(org.apache.bcel.Constants.ACC_PRIVATE,
        org.apache.bcel.generic.Type.VOID,
        argTypes, argNames, methodName,
        classGen.getClassName(),
        new InstructionList(),
        classGen.getConstantPool());
 
  _astoreHandler  = new ASTORE(HANDLER_INDEX);
  _aloadHandler   = new ALOAD(HANDLER_INDEX);
  _astoreIterator = new ASTORE(ITERATOR_INDEX);
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.InstructionList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.