Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.INVOKEINTERFACE


  if (className.equals("org.w3c.dom.Node")) {
      int index = cpg.addInterfaceMethodref(DOM_INTF,
              MAKE_NODE,
              MAKE_NODE_SIG2);
      il.append(new INVOKEINTERFACE(index, 2));
  }
        else if (className.equals("org.w3c.dom.NodeList") ||
                 className.equals("java.lang.Object")) {
      int index = cpg.addInterfaceMethodref(DOM_INTF,
              MAKE_NODE_LIST,
              MAKE_NODE_LIST_SIG2);
      il.append(new INVOKEINTERFACE(index, 2));
  }
        else if (className.equals("java.lang.String")) {
            int next = cpg.addInterfaceMethodref(NODE_ITERATOR,
                                                 "next", "()I");
            int index = cpg.addInterfaceMethodref(DOM_INTF,
                                                 GET_NODE_VALUE,
                                                 "(I)"+STRING_SIG);

            // Get next node from the iterator
            il.append(new INVOKEINTERFACE(next, 1));
            // Get the node's string value (from the DOM)
            il.append(new INVOKEINTERFACE(index, 2));
                      
        }
  else if (className.equals("int")) {
      int next = cpg.addInterfaceMethodref(NODE_ITERATOR,
              "next", "()I");
      int index = cpg.addInterfaceMethodref(DOM_INTF,
              GET_NODE_VALUE,
              "(I)"+STRING_SIG);
      int str = cpg.addMethodref(BASIS_LIBRARY_CLASS,
          STRING_TO_INT,
          STRING_TO_INT_SIG);

      // Get next node from the iterator
      il.append(new INVOKEINTERFACE(next, 1));
      // Get the node's string value (from the DOM)
      il.append(new INVOKEINTERFACE(index, 2));
      // Create a new Integer object from the string value
      il.append(new INVOKESTATIC(str));
  }
  else {
      ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
View Full Code Here


     * This function is defined to avoid code repetition.
     */
    private void getFirstNode(ClassGenerator classGen, MethodGenerator methodGen) {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();
  il.append(new INVOKEINTERFACE(cpg.addInterfaceMethodref(NODE_ITERATOR,
                NEXT,
                NEXT_SIG), 1));
    }
View Full Code Here

             + 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

 
  if (_methodName == null) {
      int index = cpg.addInterfaceMethodref(DOM_INTF,
              "getStringValue",
              "()"+STRING_SIG);
      il.append(new INVOKEINTERFACE(index, 1));
  }
  else {
      final String className = classGen.getClassName();
      final int current = methodGen.getLocalIndex("current");
     
View Full Code Here

      il.append(new ASTORE(domBuilder.getIndex()));

      // Call startDocument on the new handler
      index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                "startDocument", "()V");
      il.append(new INVOKEINTERFACE(index, 1));

      // Call the method that implements this result tree
      index = cpg.addMethodref(className,
             _methodName,
             "("
             + DOM_INTF_SIG
             + TRANSLET_OUTPUT_SIG
             +")V");
      il.append(new INVOKEVIRTUAL(index));

      // Call endDocument on the DOM handler
      il.append(new ALOAD(domBuilder.getIndex()));
      index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                "endDocument", "()V");
      il.append(new INVOKEINTERFACE(index, 1));

      // Push the new DOM on the stack
      il.append(new ALOAD(newDom.getIndex()));
  }
    }
View Full Code Here

  // Pass the type mappings to the DOM adapter
  final int mapping = cpg.addInterfaceMethodref(DOM_INTF,
                  "setupMapping",
                  "(["+STRING_SIG+
                  "["+STRING_SIG+")V");
  il.append(new INVOKEINTERFACE(mapping, 3));
  il.append(DUP);

  // Create an iterator for the root node of the DOM adapter
  final int iter = cpg.addInterfaceMethodref(DOM_INTF,
               "getIterator",
               "()"+NODE_ITERATOR_SIG);
  il.append(new INVOKEINTERFACE(iter, 1))
    }
View Full Code Here

  if (className.equals("org.w3c.dom.Node")) {
      translateTo(classGen, methodGen, Type.NodeSet);
      int index = cpg.addInterfaceMethodref(DOM_INTF,
              MAKE_NODE,
              MAKE_NODE_SIG2);
      il.append(new INVOKEINTERFACE(index, 2));
  }
  else if (className.equals("org.w3c.dom.NodeList")) {
      translateTo(classGen, methodGen, Type.NodeSet);
      int index = cpg.addInterfaceMethodref(DOM_INTF,
              MAKE_NODE_LIST,
              MAKE_NODE_LIST_SIG2);
      il.append(new INVOKEINTERFACE(index, 2));
  }
  else if (className.equals("java.lang.Object")) {
      il.append(NOP);
  }
        else if (className.equals("java.lang.String")) {
View Full Code Here

 
  final int startElement =
      cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
              "startElement",
              START_ELEMENT_SIG);
  _startElement = new INVOKEINTERFACE(startElement, 2);
 
  final int endElement =
      cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
              "endElement",
              END_ELEMENT_SIG);
  _endElement = new INVOKEINTERFACE(endElement, 2);

  final int attribute =
      cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
              "attribute",
              "("
              + STRING_SIG
              + STRING_SIG
              + ")V");
  _attribute = new INVOKEINTERFACE(attribute, 3);

  final int namespace =
      cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
              "namespace",
              "("
              + STRING_SIG
              + STRING_SIG
              + ")V");
  _namespace = new INVOKEINTERFACE(namespace, 3);
 
  int index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                "startDocument",
                "()V");
  _startDocument = new INVOKEINTERFACE(index, 1);
 
  index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
            "endDocument",
            "()V");
  _endDocument = new INVOKEINTERFACE(index, 1);
 
 
  index = cpg.addInterfaceMethodref(NODE_ITERATOR,
            SET_START_NODE,
            SET_START_NODE_SIG);
  _setStartNode = new INVOKEINTERFACE(index, 2);

  index = cpg.addInterfaceMethodref(NODE_ITERATOR,
            "reset", "()"+NODE_ITERATOR_SIG);
  _reset = new INVOKEINTERFACE(index, 1);
 
  index = cpg.addInterfaceMethodref(NODE_ITERATOR, NEXT, NEXT_SIG);
  _nextNode = new INVOKEINTERFACE(index, 1);
 
  _slotAllocator = new SlotAllocator();
  _slotAllocator.initialize(getLocalVariables());
  _allocatorInit = true;
    }
View Full Code Here

  final int getType = cpg.addInterfaceMethodref(DOM_INTF,
                  "getType", "(I)I");

  InstructionHandle begin = il.append(methodGen.loadDOM());
  il.append(SWAP);
  il.append(new INVOKEINTERFACE(getParent, 2));
  if (_left instanceof AncestorPattern) { 
      il.append(methodGen.loadDOM());
      il.append(SWAP);
  }
  il.append(new INVOKEINTERFACE(getType, 2));
  il.append(new PUSH(cpg, DOM.ROOT));
 
  final BranchHandle skip = il.append(new IF_ICMPEQ(null));
  _falseList.add(il.append(new GOTO_W(null)));
  skip.setTarget(il.append(NOP));
View Full Code Here

  if (_left != null) {
      final int getParent = cpg.addInterfaceMethodref(DOM_INTF,
                  GET_PARENT,
                  GET_PARENT_SIG);
      parent = il.append(new INVOKEINTERFACE(getParent, 2));
     
      il.append(DUP);
      il.append(storeLocal);
      _falseList.add(il.append(new IFEQ(null)));
      il.append(loadLocal);
View Full Code Here

TOP

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

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.