Package com.caucho.java

Examples of com.caucho.java.JavaWriter


    _s = _path.openWrite();
    if (encoding != null)
      _s.setEncoding(encoding);
    if (_s.getEncoding() == null || _s.getEncoding().equals("ISO-8859-1"))
      _s.setEncoding("JAVA");
    _out = new JavaWriter(_s);
    _out.setLineMap(_lineMap);
   
    _matchPatterns = new ArrayList<AbstractPattern>();
    _selectPatterns = new ArrayList<AbstractPattern>();
View Full Code Here


    println("addFunction(\"key\", keyFun);");
   
    println();
    println("com.caucho.xsl.fun.FormatNumberFun formatFun = new com.caucho.xsl.fun.FormatNumberFun();");
    println("java.text.DecimalFormatSymbols symbols;");
    JavaWriter out = _out;

    HashMap locales = _formatNumberFun.getLocales();
    iter = locales.keySet().iterator();
    while (iter.hasNext()) {
      String name = (String) iter.next();
      DecimalFormatSymbols symbols = (DecimalFormatSymbols) locales.get(name);

      out.println("symbols = new java.text.DecimalFormatSymbols();");
     
      out.print("symbols.setDecimalSeparator(\'");
      out.printJavaChar(symbols.getDecimalSeparator());
      out.println("\');");
     
      out.print("symbols.setGroupingSeparator(\'");
      out.printJavaChar(symbols.getGroupingSeparator());
      out.println("\');");
     
      out.print("symbols.setInfinity(\"");
      out.printJavaString(symbols.getInfinity());
      out.println("\");");
     
      out.print("symbols.setMinusSign(\'");
      out.printJavaChar(symbols.getMinusSign());
      out.println("\');");
     
      out.print("symbols.setNaN(\"");
      out.printJavaString(symbols.getNaN());
      out.println("\");");
     
      out.print("symbols.setPercent(\'");
      out.printJavaChar(symbols.getPercent());
      out.println("\');");
     
      out.print("symbols.setPerMill(\'");
      out.printJavaChar(symbols.getPerMill());
      out.println("\');");
     
      out.print("symbols.setZeroDigit(\'");
      out.printJavaChar(symbols.getZeroDigit());
      out.println("\');");
     
      out.print("symbols.setDigit(\'");
      out.printJavaChar(symbols.getDigit());
      out.println("\');");
     
      out.print("symbols.setPatternSeparator(\'");
      out.printJavaChar(symbols.getPatternSeparator());
      out.println("\');");

      println("formatFun.addLocale(\"" + name + "\", symbols);");
    }
   
    println("addFunction(\"format-number\", formatFun);");
View Full Code Here

    File output = new File(dir, getClassname() + ".java");
    WriteStream os = null;

    try {
      os = Vfs.openWrite(output.toString());
      JavaWriter out = new JavaWriter(os);

      out.println("package " + pkg + ";");
      out.println();
      out.println("import java.math.BigDecimal;");
      out.println("import java.math.BigInteger;");
      out.println("import java.util.List;");
      out.println("import javax.xml.bind.annotation.*;");
      out.println();

      out.print("@XmlType(name=\"" + getName() + "\"");
      if (_schema != null && _schema.getTargetNamespace() != null)
        out.print(", namespace=\"" + _schema.getTargetNamespace() + "\"");
      out.println(")");

      out.println("public class " + getClassname() + " {");

      out.pushDepth();
     
      if (_contents != null) {
        for (int i = 0; i < _contents.size(); i++) {
          if (_contents.get(i) instanceof Sequence) {
            Sequence sequence = (Sequence) _contents.get(i);

            for (Object o : sequence.getContents()) {
              if (o instanceof Element) {
                ((Element) o).generateJavaField(out);
                out.println();
              }
            }
          }
        }
      }

      out.popDepth();

      out.println("}");
    }
    finally {
      if (os != null)
        os.close();
    }

    if (_emitFaultWrapper) {
      os = null;
      output = new File(dir, getFaultWrapperClassname() + ".java");

      try {
        os = Vfs.openWrite(output.toString());
        JavaWriter out = new JavaWriter(os);

        out.println("package " + pkg + ";");
        out.println();
        out.println("import java.math.BigDecimal;");
        out.println("import java.math.BigInteger;");
        out.println("import java.util.List;");
        out.println();
        out.println("public class " + getFaultWrapperClassname());
        out.pushDepth();

        out.println("extends Exception {");
        out.println();
        out.println("private " + getClassname() + " _faultInfo;");
        out.println();

        out.print("public " + getFaultWrapperClassname() + "(String message, ");
        out.println(getClassname() + " faultInfo)");
        out.println("{");
        out.pushDepth();

        out.println("super(message);");
        out.println("_faultInfo = faultInfo;");

        out.popDepth();
        out.println("}");
        out.println();

        out.print("public " + getFaultWrapperClassname() + "(String message, ");
        out.println(getClassname() + " faultInfo, Throwable cause)");
        out.println("{");
        out.pushDepth();

        out.println("super(message, cause);");
        out.println("_faultInfo = faultInfo;");

        out.popDepth();
        out.println("}");
        out.println();

        out.println("public " + getClassname() + " getFaultInfo()");
        out.println("{");
        out.pushDepth();

        out.println("return _faultInfo;");

        out.popDepth();
        out.println("}");

        out.popDepth();
        out.println("}");
      }
      finally {
        if (os != null)
          os.close();
      }
View Full Code Here

    File output = new File(dir, getClassname() + ".java");
    WriteStream os = null;

    try {
      os = Vfs.openWrite(output.toString());
      JavaWriter out = new JavaWriter(os);

      out.println("package " + pkg + ";");
      out.println();
      out.println("import java.math.BigDecimal;");
      out.println("import java.math.BigInteger;");
      out.println("import java.util.List;");
      out.println("import javax.xml.bind.annotation.*;");
      out.println();

      out.print("@XmlType(name=\"" + getName() + "\"");
      if (_schema != null && _schema.getTargetNamespace() != null)
        out.print(", namespace=\"" + _schema.getTargetNamespace() + "\"");
      out.println(")");

      out.println("public class " + getClassname() + " {");

      out.pushDepth();
     
      if (_contents != null) {
        for (int i = 0; i < _contents.size(); i++) {
          if (_contents.get(i) instanceof Sequence) {
            Sequence sequence = (Sequence) _contents.get(i);

            for (Object o : sequence.getContents()) {
              if (o instanceof Element) {
                ((Element) o).generateJavaField(out);
                out.println();
              }
            }
          }
        }
      }

      out.popDepth();

      out.println("}");
    }
    finally {
      if (os != null)
        os.close();
    }

    if (_emitFaultWrapper) {
      os = null;
      output = new File(dir, getFaultWrapperClassname() + ".java");

      try {
        os = Vfs.openWrite(output.toString());
        JavaWriter out = new JavaWriter(os);

        out.println("package " + pkg + ";");
        out.println();
        out.println("import java.math.BigDecimal;");
        out.println("import java.math.BigInteger;");
        out.println("import java.util.List;");
        out.println();
        out.println("public class " + getFaultWrapperClassname());
        out.pushDepth();

        out.println("extends Exception {");
        out.println();
        out.println("private " + getClassname() + " _faultInfo;");
        out.println();

        out.print("public " + getFaultWrapperClassname() + "(String message, ");
        out.println(getClassname() + " faultInfo)");
        out.println("{");
        out.pushDepth();

        out.println("super(message);");
        out.println("_faultInfo = faultInfo;");

        out.popDepth();
        out.println("}");
        out.println();

        out.print("public " + getFaultWrapperClassname() + "(String message, ");
        out.println(getClassname() + " faultInfo, Throwable cause)");
        out.println("{");
        out.pushDepth();

        out.println("super(message, cause);");
        out.println("_faultInfo = faultInfo;");

        out.popDepth();
        out.println("}");
        out.println();

        out.println("public " + getClassname() + " getFaultInfo()");
        out.println("{");
        out.pushDepth();

        out.println("return _faultInfo;");

        out.popDepth();
        out.println("}");

        out.popDepth();
        out.println("}");
      }
      finally {
        if (os != null)
          os.close();
      }
View Full Code Here

        File output = new File(dir, portType.getName() + ".java");
        WriteStream os = null;

        try {
          os = Vfs.openWrite(output.toString());
          JavaWriter out = new JavaWriter(os);

          out.println("package " + pkg + ";");
          out.println();
          out.println("import java.math.BigDecimal;");
          out.println("import java.math.BigInteger;");
          out.println("import java.util.List;");
          out.println("import javax.jws.WebMethod;");
          out.println("import javax.jws.WebParam;");
          out.println("import javax.jws.WebResult;");
          out.println("import javax.jws.WebService;");
          out.println("import javax.xml.datatype.XMLGregorianCalendar;");
          out.println("import javax.xml.ws.RequestWrapper;");
          out.println("import javax.xml.ws.ResponseWrapper;");
          out.println();
          out.print("@WebService(name=\"" + portType.getName() + "\",");
          out.println("targetNamespace=\"" + getTargetNamespace() + "\")");
          out.println("public interface " + portType.getName() + "{");

          out.pushDepth();

          for (WSDLBindingOperation bindingOp : binding.getOperations()) {
            bindingOp.generateJava(out);
            out.println();
            out.println();
          }

          out.popDepth();

          out.println("}");
        }
        finally {
          if (os != null)
            os.close();
        }

        output = new File(dir, portType.getName() + "Service.java");
        os = null;

        try {
          os = Vfs.openWrite(output.toString());
          JavaWriter out = new JavaWriter(os);

          out.println("package " + pkg + ";");
          out.println();
          out.println("import java.net.URL;");
          out.println("import javax.xml.namespace.QName;");
          out.println("import javax.xml.ws.Service;");
          out.println();
          out.println("public class " + portType.getName() + "Service");
          out.println("  extends Service");
          out.println("{");

          out.pushDepth();

          out.print("public " + portType.getName() + "Service");
          out.println("(URL wsdlDocumentLocation, QName serviceName)");
          out.println("{");
          out.pushDepth();
          out.println("super(wsdlDocumentLocation, serviceName);");
          out.popDepth();
          out.println("}");

          out.popDepth();

          out.println("}");
        }
        finally {
          if (os != null)
            os.close();
        }
View Full Code Here

    _s = _path.openWrite();
    if (encoding != null)
      _s.setEncoding(encoding);
    if (_s.getEncoding() == null || _s.getEncoding().equals("ISO-8859-1"))
      _s.setEncoding("JAVA");
    _out = new JavaWriter(_s);
    _out.setLineMap(_lineMap);
   
    _matchPatterns = new ArrayList<AbstractPattern>();
    _selectPatterns = new ArrayList<AbstractPattern>();
View Full Code Here

    println("addFunction(\"key\", keyFun);");
   
    println();
    println("com.caucho.xsl.fun.FormatNumberFun formatFun = new com.caucho.xsl.fun.FormatNumberFun();");
    println("java.text.DecimalFormatSymbols symbols;");
    JavaWriter out = _out;

    HashMap locales = _formatNumberFun.getLocales();
    iter = locales.keySet().iterator();
    while (iter.hasNext()) {
      String name = (String) iter.next();
      DecimalFormatSymbols symbols = (DecimalFormatSymbols) locales.get(name);

      out.println("symbols = new java.text.DecimalFormatSymbols();");
     
      out.print("symbols.setDecimalSeparator(\'");
      out.printJavaChar(symbols.getDecimalSeparator());
      out.println("\');");
     
      out.print("symbols.setGroupingSeparator(\'");
      out.printJavaChar(symbols.getGroupingSeparator());
      out.println("\');");
     
      out.print("symbols.setInfinity(\"");
      out.printJavaString(symbols.getInfinity());
      out.println("\");");
     
      out.print("symbols.setMinusSign(\'");
      out.printJavaChar(symbols.getMinusSign());
      out.println("\');");
     
      out.print("symbols.setNaN(\"");
      out.printJavaString(symbols.getNaN());
      out.println("\");");
     
      out.print("symbols.setPercent(\'");
      out.printJavaChar(symbols.getPercent());
      out.println("\');");
     
      out.print("symbols.setPerMill(\'");
      out.printJavaChar(symbols.getPerMill());
      out.println("\');");
     
      out.print("symbols.setZeroDigit(\'");
      out.printJavaChar(symbols.getZeroDigit());
      out.println("\');");
     
      out.print("symbols.setDigit(\'");
      out.printJavaChar(symbols.getDigit());
      out.println("\');");
     
      out.print("symbols.setPatternSeparator(\'");
      out.printJavaChar(symbols.getPatternSeparator());
      out.println("\');");

      println("formatFun.addLocale(\"" + name + "\", symbols);");
    }
   
    println("addFunction(\"format-number\", formatFun);");
View Full Code Here

      if (_encoding != null)
  os.setEncoding(_encoding);
      else
  os.setEncoding("JAVA");
     
      JavaWriter out = new JavaWriter(os);

      javaClass.generate(out);
    } finally {
      os.close();
    }
View Full Code Here

      if (_encoding != null)
        os.setEncoding(_encoding);
      else
        os.setEncoding("JAVA");
     
      JavaWriter out = new JavaWriter(os);

      javaClass.generate(out);
    } finally {
      os.close();
    }
View Full Code Here

TOP

Related Classes of com.caucho.java.JavaWriter

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.