Examples of New


Examples of org.apache.bcel.generic.NEW

            default:
                // Push current output handler onto the stack
                il.append(methodGen.loadHandler());

                // Replace the current output handler by a ToXMLStream
                il.append(new NEW(cpg.addClass(STREAM_XML_OUTPUT)));
                il.append(methodGen.storeHandler());

                // Push a reference to a StringWriter
                il.append(new NEW(cpg.addClass(STRING_WRITER)));
                il.append(DUP);
                il.append(DUP);
                il.append(new INVOKESPECIAL(
                    cpg.addMethodref(STRING_WRITER, "<init>", "()V")));

                // Load ToXMLStream
                il.append(methodGen.loadHandler());
                il.append(new INVOKESPECIAL(
                    cpg.addMethodref(STREAM_XML_OUTPUT, "<init>",
                                     "()V")));

                // Invoke output.setWriter(STRING_WRITER)
                il.append(methodGen.loadHandler());
                il.append(SWAP);
                il.append(new INVOKEINTERFACE(
                    cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                              "setWriter",
                                              "("+WRITER_SIG+")V"), 2));

                // Invoke output.setEncoding("UTF-8")
                il.append(methodGen.loadHandler());
                il.append(new PUSH(cpg, "UTF-8"));   // other encodings?
                il.append(new INVOKEINTERFACE(
                    cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                              "setEncoding",
                                              "("+STRING_SIG+")V"), 2));

                // Invoke output.setOmitXMLDeclaration(true)
                il.append(methodGen.loadHandler());
                il.append(ICONST_1);
                il.append(new INVOKEINTERFACE(
                    cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                              "setOmitXMLDeclaration",
                                              "(Z)V"), 2));

                il.append(methodGen.loadHandler());
                il.append(new INVOKEINTERFACE(
                    cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                              "startDocument",
                                              "()V"), 1));

                // Inline translation of contents
                translateContents(classGen, methodGen);

                il.append(methodGen.loadHandler());
                il.append(new INVOKEINTERFACE(
                    cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
                                              "endDocument",
                                              "()V"), 1));

                // Call toString() on StringWriter
                il.append(new INVOKEVIRTUAL(
                    cpg.addMethodref(STRING_WRITER, "toString",
                                     "()" + STRING_SIG)));

                // Restore old output handler
                il.append(SWAP);
                il.append(methodGen.storeHandler());
            break;
        }

  // Send the resulting string to the message handling method
  il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS,
                 "displayMessage",
                 "("+STRING_SIG+")V")));

  // If 'terminate' attribute is set to 'yes': Instanciate a
  // RunTimeException, but it on the stack and throw an exception
  if (_terminate == true) {
      // Create a new instance of RunTimeException
      final int einit = cpg.addMethodref("java.lang.RuntimeException",
                 "<init>",
                 "(Ljava/lang/String;)V");
      il.append(new NEW(cpg.addClass("java.lang.RuntimeException")));
      il.append(DUP);
      il.append(new PUSH(cpg,"Termination forced by an " +
                 "xsl:message instruction"));
      il.append(new INVOKESPECIAL(einit));
      il.append(ATHROW);
View Full Code Here

Examples of org.apache.bcel.generic.NEW

             "("+DOM_INTF_SIG+
             "["+STRING_SIG+
             "["+STRING_SIG+
             "[I"+
             "["+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
View Full Code Here

Examples of org.apache.bcel.generic.NEW

  // Manufacture a DecimalFormatSymbols on the stack
  // for call to addDecimalFormat()
        // Use the US Locale as the default, as most of its settings
        // are equivalent to the default settings required of
  il.append(new NEW(cpg.addClass(DFS_CLASS)));
  il.append(DUP);
        il.append(new GETSTATIC(cpg.addFieldref(LOCALE_CLASS, "US",
                                                LOCALE_SIG)));
  il.append(new INVOKESPECIAL(init));
View Full Code Here

Examples of org.apache.bcel.generic.NEW

  // Manufacture a DecimalFormatSymbols on the stack for
  // call to addDecimalFormat().  Use the US Locale as the
        // default, as most of its settings are equivalent to
        // the default settings required of xsl:decimal-format -
        // except for the NaN and infinity attributes.
  il.append(new NEW(cpg.addClass(DFS_CLASS)));
  il.append(DUP);
        il.append(new GETSTATIC(cpg.addFieldref(LOCALE_CLASS, "US",
                                                LOCALE_SIG)));
  il.append(new INVOKESPECIAL(init));
View Full Code Here

Examples of org.apache.bcel.generic.NEW

                                       null, null);
            relPathIterator.setStart(
                    il.append(new ASTORE(relPathIterator.getIndex())));

      // Create new AbsoluteIterator
      il.append(new NEW(cpg.addClass(ABSOLUTE_ITERATOR)));
      il.append(DUP);
            relPathIterator.setEnd(
                    il.append(new ALOAD(relPathIterator.getIndex())));

      // Initialize AbsoluteIterator with iterator from the stack
View Full Code Here

Examples of org.apache.bcel.generic.NEW

                                          null, null);
      _path.translate(classGen, methodGen);
            pathTemp.setStart(il.append(new ASTORE(pathTemp.getIndex())));

      // Create new Dup Filter Iterator
      il.append(new NEW(cpg.addClass(DUP_FILTERED_ITERATOR)));
      il.append(DUP);
            pathTemp.setEnd(il.append(new ALOAD(pathTemp.getIndex())));

      // Initialize Dup Filter Iterator with iterator from the stack
      il.append(new INVOKESPECIAL(initDFI));
View Full Code Here

Examples of org.apache.bcel.generic.NEW

                                               null, null);
                paramTemp[i].setStart(
                        il.append(expType.STORE(paramTemp[i].getIndex())));
      }

      il.append(new NEW(cpg.addClass(_className)));
      il.append(InstructionConstants.DUP);

            for (int i = 0; i < n; i++) {
                final Expression arg = argument(i);
                paramTemp[i].setEnd(
View Full Code Here

Examples of org.apache.bcel.generic.NEW

          NodeSetType type) {
  ConstantPoolGen cpg = classGen.getConstantPool();
  InstructionList il = methodGen.getInstructionList();

  // Create a new instance of SingletonIterator
  il.append(new NEW(cpg.addClass(SINGLETON_ITERATOR)));
  il.append(DUP_X1);
  il.append(SWAP);
  final int init = cpg.addMethodref(SINGLETON_ITERATOR, "<init>",
            "(" + NODE_SIG +")V");
  il.append(new INVOKESPECIAL(init));
View Full Code Here

Examples of org.apache.bcel.generic.NEW

     */
    public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
          ReferenceType type) {
  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();
  il.append(new NEW(cpg.addClass(RUNTIME_NODE_CLASS)));
  il.append(DUP_X1);
  il.append(SWAP);
  il.append(new PUSH(cpg, _type));
  il.append(new INVOKESPECIAL(cpg.addMethodref(RUNTIME_NODE_CLASS,
                 "<init>", "(II)V")));
View Full Code Here

Examples of org.apache.bcel.generic.NEW

      il.append(new GETFIELD(cpg.addFieldref(className, "_dom",
               DOM_INTF_SIG)));

      // Create a new instance of a StringValueHandler
      int index = cpg.addMethodref(STRING_VALUE_HANDLER, "<init>", "()V");
      il.append(new NEW(cpg.addClass(STRING_VALUE_HANDLER)));
      il.append(DUP);
      il.append(DUP);
      il.append(new INVOKESPECIAL(index));
     
      // Store new Handler into a local variable
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.