Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.NEW


  // push translet for PUTFIELD
  il.append(classGen.loadTranslet());
  // prepare appropriate DOM implementation
 
  if (isMultiDocument()) {
      il.append(new NEW(cpg.addClass(MULTI_DOM_CLASS)));
      il.append(DUP);
  }
 
  il.append(classGen.loadTranslet());
  il.append(transf.loadDOM());
View Full Code Here


            "("
            + NODE_ITERATOR_SIG
            + NODE_SORT_FACTORY_SIG
            + ")V")

  il.append(new NEW(cpg.addClass(SORT_ITERATOR)));
  il.append(DUP);

  // Get the current node iterator
  if (nodeSet == null) {  // apply-templates default
      final int children = cpg.addInterfaceMethodref(DOM_INTF,
View Full Code Here

  }

  final ConstantPoolGen cpg = classGen.getConstantPool();
  final InstructionList il = methodGen.getInstructionList();
 
  il.append(new NEW(cpg.addClass(sortRecordFactoryClass)));
  il.append(DUP);
  il.append(methodGen.loadDOM());
  il.append(new PUSH(cpg, sortRecordClass));
  il.append(classGen.loadTranslet());
View Full Code Here

  final int locale =
      cpg.addFieldref(className, "_locale", LOCALE_SIG);

  if (language != null) {
      // Create new Locale object on stack
      il.append(new NEW(cpg.addClass("java/util/Locale")));
      il.append(DUP);
      il.append(DUP);
      il.append(new PUSH(cpg, language));
      il.append(new PUSH(cpg, (country != null ? country : EMPTYSTRING)));
      il.append(new INVOKESPECIAL(initLocale));
View Full Code Here

      index = cpg.addMethodref(DOM_ADAPTER_CLASS,
             "<init>",
             "("+DOM_INTF_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
View Full Code Here

     */
    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(DOUBLE_CLASS)));
  il.append(DUP_X2);
  il.append(DUP_X2);
  il.append(POP);
  il.append(new INVOKESPECIAL(cpg.addMethodref(DOUBLE_CLASS,
                 "<init>", "(D)V")));
View Full Code Here

              "<init>",
              "("
              +NODE_ITERATOR_SIG
              +NODE_ITERATOR_SIG
              +")V");
  il.append(new NEW(cpg.addClass(STEP_ITERATOR_CLASS)));
  il.append(DUP);

  // Recursively compile 2 iterators
  _filterExpr.translate(classGen, methodGen);
  _path.translate(classGen, methodGen);
View Full Code Here

            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 INVOKEVIRTUAL(
                    cpg.addMethodref(OUTPUT_BASE, "setWriter",
                                     "("+WRITER_SIG+")V")));

                // Invoke output.setEncoding("UTF-8")
                il.append(methodGen.loadHandler());
                il.append(new PUSH(cpg, "UTF-8"));   // other encodings?
                il.append(new INVOKEVIRTUAL(
                    cpg.addMethodref(OUTPUT_BASE, "setEncoding",
                                     "("+STRING_SIG+")V")));

                // Invoke output.setOmitXMLDeclaration(true)
                il.append(methodGen.loadHandler());
                il.append(ICONST_1);
                il.append(new INVOKEVIRTUAL(
                    cpg.addMethodref(OUTPUT_BASE, "setOmitXMLDeclaration",
                                     "(Z)V")));

                il.append(methodGen.loadHandler());
                il.append(new INVOKEVIRTUAL(
                    cpg.addMethodref(OUTPUT_BASE, "startDocument",
                                     "()V")));

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

                il.append(methodGen.loadHandler());
                il.append(new INVOKEVIRTUAL(
                    cpg.addMethodref(OUTPUT_BASE, "endDocument",
                                     "()V")));

                // 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

  il.append(classGen.loadTranslet());
  il.append(methodGen.loadDOM());
  // Wrap the current node inside an iterator
  int init = cpg.addMethodref(SINGLETON_ITERATOR,
            "<init>", "("+NODE_SIG+")V");
  il.append(new NEW(cpg.addClass(SINGLETON_ITERATOR)));
  il.append(DUP);
  il.append(methodGen.loadCurrentNode());
  il.append(new INVOKESPECIAL(init));

  il.append(methodGen.loadHandler());
View Full Code Here

            "<init>",
            "("
            + NODE_ITERATOR_SIG
            + ")V");
      // Create new Dup Filter Iterator
      il.append(new NEW(cpg.addClass(DUP_FILTERED_ITERATOR)));
      il.append(DUP);

      // Compile relative path iterator(s)
      _path.translate(classGen, methodGen);
View Full Code Here

TOP

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

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.