Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.INVOKEVIRTUAL


      // Call setValue on the node counter
      index = cpg.addMethodref(NODE_COUNTER,
             "setValue",
             "(D)" + NODE_COUNTER_SIG);
      il.append(new INVOKEVIRTUAL(index));
  }
  else if (isDefault()) {
      compileDefault(classGen, methodGen);
  }
  else {
      compilePatterns(classGen, methodGen);
  }

  // Call setStartNode()
  if (!hasValue()) {
      il.append(methodGen.loadContextNode());
      index = cpg.addMethodref(NODE_COUNTER,
             SET_START_NODE,
             "(I)" + NODE_COUNTER_SIG);
      il.append(new INVOKEVIRTUAL(index));
  }

  // Call getCounter() with or without args
  if (_formatNeeded) {
      if (_format != null) {
    _format.translate(classGen, methodGen);
      }
      else {
    il.append(new PUSH(cpg, "1"));
      }

      if (_lang != null) {
    _lang.translate(classGen, methodGen);
      }
      else {
    il.append(new PUSH(cpg, "en"));   // TODO ??
      }

      if (_letterValue != null) {
    _letterValue.translate(classGen, methodGen);
      }
      else {
    il.append(new PUSH(cpg, Constants.EMPTYSTRING));
      }

      if (_groupingSeparator != null) {
    _groupingSeparator.translate(classGen, methodGen);
      }
      else {
    il.append(new PUSH(cpg, Constants.EMPTYSTRING));
      }

      if (_groupingSize != null) {
    _groupingSize.translate(classGen, methodGen);
      }
      else {
    il.append(new PUSH(cpg, "0"));
      }

      index = cpg.addMethodref(NODE_COUNTER, "getCounter",
             "(" + STRING_SIG + STRING_SIG
             + STRING_SIG + STRING_SIG
             + STRING_SIG + ")" + STRING_SIG);
      il.append(new INVOKEVIRTUAL(index));
  }
  else {
      index = cpg.addMethodref(NODE_COUNTER, "setDefaultFormatting",
             "()" + NODE_COUNTER_SIG);
      il.append(new INVOKEVIRTUAL(index));

      index = cpg.addMethodref(NODE_COUNTER, "getCounter",
             "()" + STRING_SIG);
      il.append(new INVOKEVIRTUAL(index));
  }

  // Output the resulting string to the handler
  il.append(methodGen.loadHandler());
  index = cpg.addMethodref(TRANSLET_CLASS,
         CHARACTERSW,
         CHARACTERSW_SIG);
  il.append(new INVOKEVIRTUAL(index));
    }
View Full Code Here


    public void translateUnBox(ClassGenerator classGen,
             MethodGenerator methodGen) {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();
  il.append(new CHECKCAST(cpg.addClass(DOUBLE_CLASS)));
  il.append(new INVOKEVIRTUAL(cpg.addMethodref(DOUBLE_CLASS,
                 DOUBLE_VALUE,
                 DOUBLE_VALUE_SIG)));
    }
View Full Code Here

  // translate contents with substituted handler
  translateContents(classGen, methodGen);

  // get String out of the handler
  il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_VALUE_HANDLER,
                 "getValueOfPI",
                 "()" + STRING_SIG)));
  // call "processingInstruction"
  final int processingInstruction =
      cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
View Full Code Here

      StringTokenizer tokens = new StringTokenizer(_cdata);
      while (tokens.hasMoreTokens()) {
    il.append(DUP);
    il.append(new PUSH(cpg, tokens.nextToken()));
    il.append(new INVOKEVIRTUAL(index));
      }
  }
  il.append(POP); // Cleanup - pop last translet reference off stack
    }
View Full Code Here

  // This is a special case for the //* path with or without predicates
        if (_hasDescendantAxis) {
      final int incl = cpg.addMethodref(NODE_ITERATOR_BASE,
                "includeSelf",
                "()" + NODE_ITERATOR_SIG);
      il.append(new INVOKEVIRTUAL(incl));
  }

        SyntaxTreeNode parent = getParent();

        boolean parentAlreadyOrdered =
View Full Code Here

  // Add the various iterators to the UnionIterator
  final int length = _components.length;
  for (int i = 0; i < length; i++) {
      _components[i].translate(classGen, methodGen);
      il.append(new INVOKEVIRTUAL(iter));
  }

  // Order the iterator only if strictly needed
  if (_reverse) {
      final int order = cpg.addInterfaceMethodref(DOM_INTF,
View Full Code Here

  il.append(methodGen.loadDOM());
  il.append(methodGen.loadCurrentNode());
  il.append(new INVOKEINTERFACE(getNodeValue, 2));

  // Finally do the call to add an entry in the index for this key.
  il.append(new INVOKEVIRTUAL(buildKeyIndex));

  nextNode.setTarget(il.append(methodGen.loadIterator()));
  il.append(methodGen.nextNode());

  il.append(DUP);
View Full Code Here

  else {
      il.append(classGen.loadTranslet());
      il.append(new PUSH(cpg, _name.toString()));
      il.append(methodGen.loadCurrentNode());
      _use.translate(classGen, methodGen);
      il.append(new INVOKEVIRTUAL(key));
  }
 
  // Get the next node from the iterator and do loop again...
  final InstructionHandle skip = il.append(NOP);
 
View Full Code Here

  // Overwrite old handler with DOM handler
  index = cpg.addMethodref(DOM_IMPL,
         "getOutputDomBuilder",
         "()" + TRANSLET_OUTPUT_SIG);

  il.append(new INVOKEVIRTUAL(index));
  il.append(DUP);
  il.append(methodGen.storeHandler());

  // Call startDocument on the new handler
  il.append(methodGen.startDocument());

  // Instantiate result tree fragment
  translateContents(classGen, methodGen);

  // Call endDocument on the new handler
  il.append(methodGen.loadHandler());
  il.append(methodGen.endDocument());

  // Check if we need to wrap the DOMImpl object in a DOMAdapter object
  if (!DOM_CLASS.equals(DOM_IMPL_CLASS)) {
      // new org.apache.xalan.xsltc.dom.DOMAdapter(DOMImpl,String[]);
      index = cpg.addMethodref(DOM_ADAPTER_CLASS,
             "<init>",
             "("+DOM_IMPL_SIG+
             "["+STRING_SIG+
             "["+STRING_SIG+")V");
      il.append(new NEW(cpg.addClass(DOM_ADAPTER_CLASS)));
      il.append(new DUP_X1());
      il.append(SWAP);

      /*
       * Give the DOM adapter an empty type mapping if the nodeset
       * extension function is never called.
       */
      if (!stylesheet.callsNodeset()) {
    il.append(new ICONST(0));
    il.append(new ANEWARRAY(cpg.addClass(STRING)));
    il.append(DUP);
    il.append(new INVOKESPECIAL(index));
      }
      else {
    // Push name arrays on the stack
    il.append(ALOAD_0);
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
             NAMES_INDEX,
             NAMES_INDEX_SIG)));
    il.append(ALOAD_0);
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
             NAMESPACE_INDEX,
             NAMESPACE_INDEX_SIG)));

    // Initialized DOM adapter
    il.append(new INVOKESPECIAL(index));

    // Add DOM adapter to MultiDOM class by calling addDOMAdapter()
    il.append(DUP);
    il.append(methodGen.loadDOM());
    il.append(new CHECKCAST(cpg.addClass(classGen.getDOMClass())));
    il.append(SWAP);
    index = cpg.addMethodref(MULTI_DOM_CLASS,
           "addDOMAdapter",
           "(" + DOM_ADAPTER_SIG + ")I");
    il.append(new INVOKEVIRTUAL(index));
    il.append(POP);    // ignore mask returned by addDOMAdapter
      }
  }

  // Restore old handler base from stack
View Full Code Here

  // translate contents with substituted handler
  translateContents(classGen, methodGen);

  // get String out of the handler
  il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_VALUE_HANDLER,
                 "getValue",
                 "()" + STRING_SIG)));
  // call "comment"
  final int comment =
      cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
View Full Code Here

TOP

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

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.