Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.INVOKEVIRTUAL


      buffer.append(getSignature(_chosenMethod.getReturnType()));

      index = cpg.addMethodref(clazz,
             _fname.getLocalPart(),
             buffer.toString());
      il.append(_thisArgument != null ? (InvokeInstruction) new INVOKEVIRTUAL(index) :
            (InvokeInstruction) new INVOKESTATIC(index));
      // Convert the return type back to our internal type
      _type.translateFrom(classGen, methodGen,
        _chosenMethod.getReturnType());
View Full Code Here


               MethodGenerator methodGen,
               BooleanType type) {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();

  il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS,
                 "length", "()I")));
  return new FlowList(il.append(new IFEQ(null)));
    }
View Full Code Here

  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();

  il.append(DUP);
  final BranchHandle ifNull = il.append(new IFNULL(null));
  il.append(new INVOKEVIRTUAL(cpg.addMethodref(_javaClassName,
                "toString",
                "()" + STRING_SIG)));
  final BranchHandle gotobh = il.append(new GOTO(null));
  ifNull.setTarget(il.append(POP));
  il.append(new PUSH(cpg, ""));
View Full Code Here

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

      // 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));
     
      // Restore new handler and call getValue()
      il.append(new ALOAD(handler.getIndex()));
      index = cpg.addMethodref(STRING_VALUE_HANDLER,
             "getValue",
             "()" + STRING_SIG);
      il.append(new INVOKEVIRTUAL(index));
  }
    }
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(DUP);

      // Store DOM handler in a local in order to call endDocument()
      domBuilder =
    methodGen.addLocalVariable("rt_to_reference_handler",
             Util.getJCRefType(TRANSLET_OUTPUT_SIG),
             null, null);
      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");
View Full Code Here

  if ((tmp == null) || (tmp.equals(EMPTYSTRING))) {
      int nan = cpg.addMethodref(DFS_CLASS,
               "setNaN", "(Ljava/lang/String;)V");
      il.append(DUP);
      il.append(new PUSH(cpg, "NaN"));
      il.append(new INVOKEVIRTUAL(nan));
  }

  tmp = getAttribute("infinity");
  if ((tmp == null) || (tmp.equals(EMPTYSTRING))) {
      int inf = cpg.addMethodref(DFS_CLASS,
               "setInfinity",
               "(Ljava/lang/String;)V");
      il.append(DUP);
      il.append(new PUSH(cpg, "Infinity"));
      il.append(new INVOKEVIRTUAL(inf));
  }
     
  final int nAttributes = _attributes.getLength();
  for (int i = 0; i < nAttributes; i++) {
      final String name = _attributes.getQName(i);
      final String value = _attributes.getValue(i);

      boolean valid = true;
      int method = 0;

      if (name.equals("decimal-separator")) {
    // DecimalFormatSymbols.setDecimalSeparator();
    method = cpg.addMethodref(DFS_CLASS,
            "setDecimalSeparator", "(C)V");
      }
      else if (name.equals("grouping-separator")) {
    method =  cpg.addMethodref(DFS_CLASS,
             "setGroupingSeparator", "(C)V");
      }
      else if (name.equals("minus-sign")) {
    method = cpg.addMethodref(DFS_CLASS,
            "setMinusSign", "(C)V");
      }
      else if (name.equals("percent")) {
    method = cpg.addMethodref(DFS_CLASS,
            "setPercent", "(C)V");
      }
      else if (name.equals("per-mille")) {
    method = cpg.addMethodref(DFS_CLASS,
            "setPerMill", "(C)V");
      }
      else if (name.equals("zero-digit")) {
    method = cpg.addMethodref(DFS_CLASS,
            "setZeroDigit", "(C)V");
      }
      else if (name.equals("digit")) {
    method = cpg.addMethodref(DFS_CLASS,
            "setDigit", "(C)V");
      }
      else if (name.equals("pattern-separator")) {
    method = cpg.addMethodref(DFS_CLASS,
            "setPatternSeparator", "(C)V");
      }
      else if (name.equals("NaN")) {
    method = cpg.addMethodref(DFS_CLASS,
            "setNaN", "(Ljava/lang/String;)V");
          il.append(DUP);
    il.append(new PUSH(cpg, value));
    il.append(new INVOKEVIRTUAL(method));
    valid = false;
      }
      else if (name.equals("infinity")) {
    method = cpg.addMethodref(DFS_CLASS,
            "setInfinity",
            "(Ljava/lang/String;)V");
          il.append(DUP);
    il.append(new PUSH(cpg, value));
    il.append(new INVOKEVIRTUAL(method));
    valid = false;
      }
      else {
    valid = false;
      }

      if (valid) {
    il.append(DUP);
    il.append(new PUSH(cpg, value.charAt(0)));
    il.append(new INVOKEVIRTUAL(method));
      }

  }

  final int put = cpg.addMethodref(TRANSLET_CLASS,
           "addDecimalFormat",
           "("+STRING_SIG+DFS_SIG+")V");
  il.append(new INVOKEVIRTUAL(put));
    }
View Full Code Here

  int nan = cpg.addMethodref(DFS_CLASS,
           "setNaN", "(Ljava/lang/String;)V");
  il.append(DUP);
  il.append(new PUSH(cpg, "NaN"));
  il.append(new INVOKEVIRTUAL(nan));

  int inf = cpg.addMethodref(DFS_CLASS,
           "setInfinity",
           "(Ljava/lang/String;)V");
  il.append(DUP);
  il.append(new PUSH(cpg, "Infinity"));
  il.append(new INVOKEVIRTUAL(inf));

  final int put = cpg.addMethodref(TRANSLET_CLASS,
           "addDecimalFormat",
           "("+STRING_SIG+DFS_SIG+")V");
  il.append(new INVOKEVIRTUAL(put));
    }
View Full Code Here

  // Translate the contents.
  il.append(classGen.loadTranslet());
  _select.translate(classGen, methodGen)
  il.append(methodGen.loadHandler());
  il.append(new INVOKEVIRTUAL(characters));

  // Restore character escaping setting to whatever it was.
  if (!_escaping) {
      il.append(methodGen.loadHandler());
      il.append(SWAP);
View Full Code Here

      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
View Full Code Here

      // Push parameter frame
      final int push = cpg.addMethodref(TRANSLET_CLASS,
                PUSH_PARAM_FRAME,
                PUSH_PARAM_FRAME_SIG);
      il.append(classGen.loadTranslet());
      il.append(new INVOKEVIRTUAL(push));
      // Translate with-params
      translateContents(classGen, methodGen);
  }

  final String className = stylesheet.getClassName();
  // Generate a valid Java method name
  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
                 + NODE_SIG
                 +")V")));
 

  if (stylesheet.hasLocalParams() || hasContents()) {
      // Pop parameter frame
      final int pop = cpg.addMethodref(TRANSLET_CLASS,
               POP_PARAM_FRAME,
               POP_PARAM_FRAME_SIG);
      il.append(classGen.loadTranslet());
      il.append(new INVOKEVIRTUAL(pop));
  }
    }
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.