xml-xmlbeans-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject cvs commit: xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/joust Expression.java ExpressionFactory.java FileWriterFactory.java JavaOutputStream.java SourceJavaOutputStream.java ValidatingJavaOutputStream.java Variable.java WriterFactory.java
Date Fri, 05 Dec 2003 19:59:10 GMT
pcal        2003/12/05 11:59:10

  Added:       v2/src/binding/org/apache/xmlbeans/impl/binding/joust
                        Expression.java ExpressionFactory.java
                        FileWriterFactory.java JavaOutputStream.java
                        SourceJavaOutputStream.java
                        ValidatingJavaOutputStream.java Variable.java
                        WriterFactory.java
  Log:
  joust: initial check-in
  
  Revision  Changes    Path
  1.1                  xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/joust/Expression.java
  
  Index: Expression.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  package org.apache.xmlbeans.impl.binding.joust;
  
  /**
   * Provides a handle to a java expression in the generated code.
   *
   * @author Patrick Calahan <pcal@bea.com>
   */
  public interface Expression {
  
    /**
     * This value is provided by and used only by implementations of
     * JavaOutputStream.  The memento is simply a place for the implementation
     * to hang a reference to some domain object that the Expression actually
     * represents.
     */
    public Object getMemento();
  
    /**
     * Provides a textual representation of the expression.  This should
     * only be used for logging or debugging purposes.
     */
    //  public String getLabel();   //not clear to me this is worthwhile
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/joust/ExpressionFactory.java
  
  Index: ExpressionFactory.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  package org.apache.xmlbeans.impl.binding.joust;
  
  /**
   * Creates instances of Expression to be used in conjunction with a
   * JavaOutputStream.  Instances of ExpressionFactory are retrieved via
   * JavaOutputStream.getExpressionFactory().
   *
   * We'll probably have to add more methods here to accommodate more
   * primitives, arrays and so forth.
   *
   * @author Patrick Calahan <pcal@bea.com>
   */
  public interface ExpressionFactory {
  
    /**
     * Returns an expression representing a constant boolean value.
     */
    public Expression createBoolean(boolean value);
  
    /**
     * Returns an expression representing a literal string.
     */
    public Expression createString(String value);
  
    /**
     * Returns an expression representing a constant int.
     */
    public Expression createInt(int value);
  
    /**
     * Returns an expression representing the 'null' token.
     */
    public Expression createNull();
  
  }
  
  
  1.1                  xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/joust/FileWriterFactory.java
  
  Index: FileWriterFactory.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  package org.apache.xmlbeans.impl.binding.joust;
  
  import java.io.File;
  import java.io.FileWriter;
  import java.io.IOException;
  import java.io.Writer;
  
  /**
   * Implementation of WriterFactory which creates files for new classes under
   * a specified source root.
   */
  public class FileWriterFactory implements WriterFactory {
  
    // ========================================================================
    // Constants
  
    // might need to make this settable someday
    private static final String EXTENSION = ".java";
    private static final char PACKAGE_SEPARATOR = '.';
  
    // ========================================================================
    // Variables
  
    private File mSourceRoot;
  
    // ========================================================================
    // Constructors
  
    public FileWriterFactory(File sourceRoot) {
      if (sourceRoot == null) throw new IllegalArgumentException();
      if (!sourceRoot.mkdirs()) {
        throw new IllegalArgumentException("Failed to create directory " +
                                           sourceRoot);
      }
      mSourceRoot = sourceRoot;
    }
  
    // ========================================================================
    // WriterFactory implementation
  
    public Writer createWriter(String packageName, String className)
            throws IOException {
      File dir = new File(mSourceRoot, packageName.replace
                                       (PACKAGE_SEPARATOR, File.separatorChar));
      if (!dir.mkdirs()) {
        throw new IllegalArgumentException("Failed to create directory " + dir);
      }
      File outFile = new File(dir, className + EXTENSION);
      return new FileWriter(outFile);
    }
  }
  
  
  1.1                  xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/joust/JavaOutputStream.java
  
  Index: JavaOutputStream.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  package org.apache.xmlbeans.impl.binding.joust;
  
  import java.io.IOException;
  
  /**
   * <p>A JavaOutputStream is a service which provides sequential, read-only
   * java code-generation service. This is not a general-purpose java code
   * generator, but rather is tailored to produce java constructs required
   * for XMLbeans.</p>
   *
   * <p>By using this interface, the schema-to-java binding logic is isolated from
   * the details of java code generation.  This in turn allows for pluggability
   * of the generation logic - for example, one code generator might generate
   * java source files, while another might directly generate byte codes in
   * memory.</p>
   *
   * <b>A note about 'Type Names'</b>
   *
   * <p>A number of method signatures in this interface contain a String parameter
   * which is described as a 'Type Name.'  This is expected to be any
   * type declaration as you would normally see in java source code, e.g.
   * <code>int</code>, <code>String[][]</code>, <code>java.util.List</code>,
   * or <code>MyImportedClass</code>.  More specifically, it must be a valid
   * <code>TypeName</code> as described in
   * <a href='http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#73064'>
   * section 6.5.5 </a> of the Java Language Specification.</p>
   *
   * @author Patrick Calahan <pcal@bea.com>
   *
   */
  public interface JavaOutputStream {
  
    /**
     * Instructs the stream to begin writing a class with the given attributes.
     *
     * @param modifiers A java.lang.reflect.Modifier value describing the
     *        modifiers which apply to the new class.
     * @param packageName Fully-qualified name of the package which should
     *        contain the new class.
     * @param simpleName Unqualified name of the new class.
     * @param extendsClassName Name the class which the new class extends, or
     *        null if it should not extend anything.  The class name must be
     *        fully-qualified.
     * @param implementsInterfaceNames Array of interface names, one
     *        for each interface implemented by the new class, or null if
     *        the class does not implement anything.  Each class name must be
     *        fully-qualified.
     *
     * @throws IllegalStateException if the current stream state does not allow
     *         beginning a new class.
     * @throws IllegalArgumentException if modifers is not valid for a class,
     *         if packagename or classname is null or malformed, or if
     *         any class name parameter is malformed.
     */
    public void startClass(int modifiers,
                           String packageName,
                           String simpleName,
                           String extendsClassName,
                           String[] implementsInterfaceNames)
            throws IOException;
  
    /**
     * Instructs the stream to begin writing a new interface.
     *
     * @param packageName Fully-qualified name of the package which should
     *        contain the new interface.
     * @param simpleName Unqualified name of the new interface.
     * @param extendsInterfaceNames Array of interface names, one
     *        for each interface extendded by the new interface, or null if
     *        the interface does not extend anything.  Each class name must be
     *        fully-qualified.
     *
     * @throws IllegalStateException if the current stream state does not allow
     *         beginning a new interface.
     * @throws IllegalArgumentException if classname is null or if any classname
     *         parameters is malformed.
     */
    public void startInterface(String packageName,
                               String simpleName,
                               String[] extendsInterfaceNames)
            throws IOException;
  
    /**
     * Instructs the stream to write out a field (member variable) declaration
     * for the current class.
     *
     * @param modifiers A java.lang.reflect.Modifier value describing the
     *        modifiers which apply to the new field.
     * @param typeName The Type Name (see above) for the new field.
     * @param fieldName The name of the new field.
     * @param defaultValue An Expression describing the default value for the
     *                     new field, or null if none should be declared.
     *
     * @throws IllegalStateException if the current stream state does not allow
     *         a field declaration (e.g. if startClass has not been called).
     * @throws IllegalArgumentException if any type name is null or malformed or
     *         fieldName is null or not a valid java identifier, or if modifiers
     *         cannot be applied to a field.
     *
     * @return A handle to the field that is created.
     */
    public Variable writeField(int modifiers,
                               String typeName,
                               String fieldName,
                               Expression defaultValue) throws IOException;
  
    /**
     * Instructs the stream to write out a constructor for the current class.
     *
     * @param modifiers A java.lang.reflect.Modifier value describing the
     *        modifiers which apply to the new constructor.
     * @param paramTypeNames An array of Type Names (see above) for each of the
     *        constructor's parameters, or null if this is to be the default
     *        constructor.
     * @param paramNames An array of parameter names for each of the
     *        constructor's parameters, or null if this is to be the default
     *        constructor.
     * @param exceptionClassNames An array of class names, one
     *        for each exception type to be thrown by the new constructor, or
     *        null if the constructor does not throw anything.  Each name need
     *        not be qualified.
     *
     * @throws IllegalStateException if the current stream state does not allow
     *         a constructor declaration.
     * @throws IllegalArgumentException if paramTypeNames and paramNames are
     *         not of the same length (or both null), if any type name or
     *         exception class name is null or malformed, if the modifiers
     *         cannot be applied to a constructor.
     *
     * @return An array of Variables which provide handles to the parameters
     *         of the generated constructor.  Returns an empty array if the
     *         constructor does not take any parameters.
     */
    public Variable[] startConstructor(int modifiers,
                                       String[] paramTypeNames,
                                       String[] paramNames,
                                       String[] exceptionClassNames)
            throws IOException;
  
    /**
     * Instructs the stream to write out a new method for the current class.
     *
     * @param modifiers A java.lang.reflect.Modifier value describing the
     *        modifiers which apply to the new method.
     * @param methodName A name for the new method.
     * @param returnTypeName A Type Name (see above) for the method's return
     *        value, or "<code>void</vode>" if the method is void.
     * @param paramTypeNames An array of Type Names (see above) for each of the
     *        method's parameters, or null if the method takes no parameters.
     * @param paramNames An array of parameter names for each of the
     *        method's parameters, or null if the method takes no parameters.
     * @param exceptionClassNames An array of class names, one
     *        for each exception type to be thrown by the method, or
     *        null if the methoddoes not throw anything.  Each class name must
     *        be fully-qualified.
     *
     * @throws IllegalStateException if the current stream state does not allow
     *         a new method declaration.
     * @throws IllegalArgumentException if paramTypeNames and paramNames are
     *         not of the same length (or both null), if any type name or
     *         exception class name is null or malformed, if the modifiers
     *         cannot be applied to a method, or if methodName is null or
     *         malformed.
     *
     * @return An array of Variables which provide handles to the parameters
     *         of the generated method.  Returns an empty array if the method
     *         does not take any parameters.
     */
    public Variable[] startMethod(int modifiers,
                                  String methodName,
                                  String returnTypeName,
                                  String[] paramTypeNames,
                                  String[] paramNames,
                                  String[] exceptionClassNames)
            throws IOException;
  
    /**
     * Writes out a source-code comment in the current class.  The comment
     * will usually be interpreted as applying to whatever is written next
     * in the stream, i.e. to write comments about a given class, you should
     * first call writeComment and then call writeClass.  The precise
     * formatting of the comments will be implementation-dependendent, and
     * some implementations may ignore comments altogether.
     *
     * @param comment The text of the comment.
     *
     * @throws IllegalStateException if the current stream state does not allow
     *         a field declaration (e.g. if startClass has not been called).
     *         writeComment should be a valid operation at all other times.
     */
    public void writeComment(String comment) throws IOException;
  
    /**
     * Writes out a return statement for the current method that returns
     * the given expression.
     *
     * @param  expression A handle to the expression to be returned.
     *
     * @throws IllegalArgumentException if expression is null.
     * @throws IllegalStateException if the current stream state does not allow
     *         a return declaration (e.g. if startMethod has not been called or
     *         the current method is void).
     */
    public void writeReturnStatement(Expression expression) throws IOException;
  
    /**
     * Writes out a return statement for the current method that returns
     * the given expression.
     *
     * @param  left A handle to the variable that goes on the left side
     *         of the equals sign.
     * @param  right A handle to the expression which goes on the right side
     *         of the equals sign.
     *
     * @throws IllegalArgumentException if either parameter is null.
     * @throws IllegalStateException if the current stream state does not allow
     *         an assignment declaration (e.g. if startMethod or
     *         startConstructor has not been called).
     */
    public void writeAssignmentStatement(Variable left, Expression right)
            throws IOException;
  
    /**
     * Instructs the stream to finish writing the current method or constructor.
     * Every call to startMethod or startConstructor must be balanced by a call
     * to endClassOrConstructor.
     *
     * @throws IllegalStateException if the current stream state does not allow
     *         the end of a class or interface.
     */
    public void endMethodOrConstructor() throws IOException;
  
    /**
     * Instructs the stream to finish writing the current class or interface.
     * Every call to startClass or startInterface must be balanced by a call to
     * endClassOrInterface.
     *
     * @throws IllegalStateException if the current stream state does not allow
     *         the end of a class or interface.
     */
    public void endClassOrInterface() throws IOException;
  
    /**
     * Returns the ExpressionFactory that should be to create instances of
     * Expression to be used in conjunction with this JavaOutputStream.
     *
     * @return An ExpressionFactory.  Must never return null.
     */
    public ExpressionFactory getExpressionFactory();
  
    /**
     * Closes the JavaOutputStream.  This should be called exactly once and
     * only when you are completely finished with the stream.
     */
    public void close() throws IOException;
  }
  
  
  1.1                  xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/joust/SourceJavaOutputStream.java
  
  Index: SourceJavaOutputStream.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  package org.apache.xmlbeans.impl.binding.joust;
  
  import java.io.IOException;
  import java.io.PrintWriter;
  import java.io.Writer;
  import java.lang.reflect.Modifier;
  import java.util.StringTokenizer;
  
  /**
   * <p>Implementation of JavaOutputStream which outputs Java source code.</p>
   *
   * <p>Note that this class has no direct knowledge of where that source code
   * goes; that functionality is factored out into the WriterFactory interface,
   * which returns a new PrintWriter for a given package and class name on
   * demand.  Typically, the implementation will be FileWriterFactory, which
   * simply creates files under a source root directory, but this factoring
   * allows for other arrangements to be supported.</p>
   *
   * @author Patrick Calahan <pcal@bea.com>
   */
  public class SourceJavaOutputStream
          implements JavaOutputStream, ExpressionFactory {
  
    // ========================================================================
    // Constants
  
    private static final String COMMENT_LINE_DELIMITERS = "\n\r\f";
    private static final String INDENT_STRING = "  ";
  
    // ========================================================================
    // Variables
  
    private PrintWriter mOut = null;
    private int mIndentLevel = 0;
    private String mConstructorName;
    private WriterFactory mWriterFactory;
  
    // ========================================================================
    // Constructors
  
    public SourceJavaOutputStream(WriterFactory factory) {
      if (factory == null) throw new IllegalArgumentException();
      mWriterFactory = factory;
    }
  
    // ========================================================================
    // JavaOutputStream implementation
  
    public void startClass(int modifiers,
                           String packageName,
                           String simpleName,
                           String extendsClassName,
                           String[] interfaceNames)
            throws IOException {
      mConstructorName = simpleName;
      mOut = startNewFile(packageName, simpleName);
      mOut.println("package " + packageName + ";");
      mOut.println();
      // We need to write up the actual class declaration and save it until
      // after the imports have been written
      //FIXME we should format this code more nicely
      mOut.print(Modifier.toString(modifiers));
      mOut.print(" class ");
      mOut.print(simpleName);
      if (extendsClassName != null) {
        mOut.print(" extends ");
        mOut.print(extendsClassName);
      }
      if (interfaceNames != null && interfaceNames.length > 0) {
        mOut.print(" implements ");
        for (int i = 0; i < interfaceNames.length; i++) {
          mOut.print(interfaceNames[i]);
          if (i < interfaceNames.length - 1) mOut.print(", ");
        }
      }
      mOut.println(" {");
      mOut.println();
      increaseIndent();
    }
  
  
    public void startInterface(String packageName,
                               String simpleName,
                               String[] interfaceNames)
            throws IOException {
      mConstructorName = simpleName;
      mOut = startNewFile(packageName, simpleName);
      mOut.println("package " + packageName + ";");
      // We need to write up the actual class declaration and save it until
      // after the imports have been written
      //FIXME we should format this code more nicely
      mOut.print("public interface ");
      mOut.print(simpleName);
      if (interfaceNames != null && interfaceNames.length > 0) {
        mOut.print(" extends ");
        for (int i = 0; i < interfaceNames.length; i++) {
          mOut.print(interfaceNames[i]);
          if (i < interfaceNames.length - 1) mOut.print(", ");
        }
      }
      mOut.println("{");
      mOut.println();
      increaseIndent();
    }
  
    public Variable writeField(int modifiers,
                               String typeName,
                               String fieldName,
                               Expression defaultValue) throws IOException {
      printIndents();
      mOut.print(Modifier.toString(modifiers));
      mOut.print(" ");
      mOut.print(typeName);
      mOut.print(" ");
      mOut.print(fieldName);
      if (defaultValue != null) {
        mOut.print(" = ");
        mOut.print(((String) defaultValue.getMemento()));
      }
      mOut.println(';');
      mOut.println();
      return newVar("this." + fieldName);
    }
  
    public Variable[] startConstructor(int modifiers,
                                       String[] paramTypeNames,
                                       String[] paramNames,
                                       String[] exceptionClassNames)
            throws IOException {
      return startMethod(modifiers, mConstructorName, null,
                         paramTypeNames, paramNames, exceptionClassNames);
    }
  
    public Variable[] startMethod(int modifiers,
                                  String methodName,
                                  String returnTypeName,
                                  String[] paramTypeNames,
                                  String[] paramNames,
                                  String[] exceptionClassNames)
            throws IOException {
      printIndents();
      mOut.print(Modifier.toString(modifiers));
      mOut.print(" ");
      if (returnTypeName != null) {
        mOut.print(returnTypeName);
        mOut.print(" ");
      }
      mOut.print(methodName);
      // print the parameter list
      Variable[] ret;
      if (paramTypeNames == null || paramTypeNames.length == 0) {
        mOut.print("(}");
        ret = new Variable[0];
      } else {
        ret = new Variable[paramTypeNames.length];
        for (int i = 0; i < ret.length; i++) {
          mOut.print((i == 0) ? "(" : ", ");
          ret[i] = newVar(paramNames[i]);
          mOut.print(paramTypeNames[i]);
          mOut.print(' ');
          mOut.print(paramNames[i]);
        }
        mOut.print(")");
      }
      // print the throws clause
      if (exceptionClassNames != null && exceptionClassNames.length > 0) {
        for (int i = 0; i < exceptionClassNames.length; i++) {
          mOut.print((i == 0) ? " throws " : ", ");
          mOut.print(exceptionClassNames[i]);
        }
      }
      mOut.println();
      increaseIndent();
      return ret;
    }
  
    public void writeComment(String comment) throws IOException {
      printIndents();
      mOut.println("/**");
      StringTokenizer st = new StringTokenizer(comment, COMMENT_LINE_DELIMITERS);
      while (st.hasMoreTokens()) {
        printIndents();
        mOut.print(" * ");
        mOut.println(st.nextToken());
      }
      printIndents();
      mOut.println(" */");
    }
  
    public void writeReturnStatement(Expression expression) throws IOException {
      printIndents();
      mOut.print("return ");
      mOut.print(((String) expression.getMemento()));
      mOut.println(";");
    }
  
    public void writeAssignmentStatement(Variable left, Expression right)
            throws IOException {
      printIndents();
      mOut.print(((String) left.getMemento()));
      mOut.print(" = ");
      mOut.print(((String) right.getMemento()));
      mOut.println(";");
    }
  
    public void endMethodOrConstructor() throws IOException {
      reduceIndent();
      printIndents();
      mOut.println('}');
      mOut.println();
    }
  
    public void endClassOrInterface() throws IOException {
      reduceIndent();
      printIndents();
      mOut.println('}');
    }
  
    public ExpressionFactory getExpressionFactory() {
      return this;
    }
  
    public void close() throws IOException {
      closeOut();
    }
  
    // ========================================================================
    // ExpressionFactory implementation
  
    private static final Expression TRUE = newExp("true");
    private static final Expression FALSE = newExp("true");
    private static final Expression NULL = newExp("null");
  
    public Expression createBoolean(boolean value) {
      return value ? TRUE : FALSE;
    }
  
    public Expression createString(String value) {
      return newExp("\"" + value + "\"");
    }
  
    public Expression createInt(int value) {
      return newExp(String.valueOf(value));
    }
  
    public Expression createNull() {
      return NULL;
    }
  
    // ========================================================================
    // Private methods
  
    private PrintWriter startNewFile(String packageName,
                                     String simpleName) throws IOException {
      closeOut();
      if (mIndentLevel != 0) throw new IllegalStateException(); //sanity check
      return new PrintWriter(mWriterFactory.createWriter(packageName, simpleName));
    }
  
    private void printIndents() throws IOException {
      for (int i = 0; i < mIndentLevel; i++) mOut.print(INDENT_STRING);
    }
  
    private void increaseIndent() {
      mIndentLevel++;
    }
  
    private void reduceIndent() {
      mIndentLevel--;
      if (mIndentLevel < 0) throw new IllegalStateException(); //sanity check
    }
  
    private void closeOut() throws IOException {
      if (mOut != null) {
        mOut.close();
        mOut = null;
      }
    }
  
    private static Expression newExp(final String s) {
      return new Expression() {
        public Object getMemento() {
          return s;
        }
      };
    }
  
    private static Variable newVar(final String s) {
      return new Variable() {
        public Object getMemento() {
          return s;
        }
      };
    }
  
    // ========================================================================
    // main() - quick test
  
    public static void main(String[] args) throws IOException {
      SourceJavaOutputStream sjos = new SourceJavaOutputStream
              (new WriterFactory() {
                private PrintWriter OUT = new PrintWriter(System.out);
  
                public Writer createWriter(String x, String y) {
                  return OUT;
                }
              });
      JavaOutputStream joust = new ValidatingJavaOutputStream(sjos);
      ExpressionFactory exp = joust.getExpressionFactory();
      joust.startClass(Modifier.PUBLIC | Modifier.FINAL,
                       "foo.bar.baz", "MyClass", "MyBaseClass", null);
      String[] paramNames = {"count", "fooList"};
      String[] paramTypes = {"int", "List"};
      String[] exceptions = {"IOException"};
      Variable counter =
              joust.writeField(Modifier.PRIVATE, "int", "counter", exp.createInt(99));
      joust.writeComment("This is the constructor\n@foo godzilla\n@bar mothra");
      Variable[] params = joust.startConstructor
              (Modifier.PUBLIC, paramNames, paramTypes, exceptions);
      joust.writeAssignmentStatement(counter, params[0]);
      joust.endMethodOrConstructor();
      joust.endClassOrInterface();
      joust.close();
    }
  }
  
  
  1.1                  xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/joust/ValidatingJavaOutputStream.java
  
  Index: ValidatingJavaOutputStream.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  package org.apache.xmlbeans.impl.binding.joust;
  
  import java.io.IOException;
  
  /**
   * <p>Performs some boilerplate input validation and state checking on stream
   * operations and then delegates to another JavaOutputStream.  This class
   * simply allows validation logic to be reused by multiple implementations of
   * JavaOutputStream.</p>
   *
   *
   * State diagram:
   *
   * <pre>
   *   +<-----endClass<-----+ +<-------------------------------+
   *   |                    | |                                |
   * BEGIN-->startClass--->CLASS-------->writeImport---------->+
   *                         |                                 |
   *                         +------->writeMemberVariable----->+
   *                         |                                 |
   *                         +--->startMethod--->METHOD--->endMethod
   *                               (or ctor)      | ^      (or ctor)
   *                                              V |
   *                                       write...Statement
   * </pre>
   *
   * @author Patrick Calahan <pcal@bea.com>
   */
  public class ValidatingJavaOutputStream implements JavaOutputStream {
  
    // FIXME This class isn't implemented yet - it's just a proxy that isn't
    // FIXME doing any validation
  
    // ========================================================================
    // Constants
  
    // ========================================================================
    // Variables
  
    private JavaOutputStream mDest;
  
    // ========================================================================
    // Constructors
  
    public ValidatingJavaOutputStream(JavaOutputStream destination) {
      if (destination == null) throw new IllegalArgumentException();
      mDest = destination;
    }
  
    // ========================================================================
    // JavaOutputStream implementation
  
    public void startClass(int modifiers,
                           String packageName,
                           String simpleName,
                           String extendsClassName,
                           String[] implementsInterfaceNames)
            throws IOException {
      mDest.startClass(modifiers, packageName, simpleName,
                       extendsClassName, implementsInterfaceNames);
    }
  
    public void startInterface(String packageName,
                               String simpleName,
                               String[] extendsInterfaceNames)
            throws IOException {
      mDest.startInterface(packageName, simpleName, extendsInterfaceNames);
    }
  
    public Variable writeField(int modifiers,
                               String typeName,
                               String fieldName,
                               Expression defaultValue) throws IOException {
      return mDest.writeField(modifiers, typeName, fieldName, defaultValue);
    }
  
    public Variable[] startConstructor(int modifiers,
                                       String[] paramTypeNames,
                                       String[] paramNames,
                                       String[] exceptionClassNames)
            throws IOException {
      return mDest.startConstructor(modifiers, paramTypeNames,
                                    paramNames, exceptionClassNames);
    }
  
    public Variable[] startMethod(int modifiers,
                                  String methodName,
                                  String returnTypeName,
                                  String[] paramTypeNames,
                                  String[] paramNames,
                                  String[] exceptionClassNames)
            throws IOException {
      return mDest.startMethod(modifiers, methodName, returnTypeName,
                               paramTypeNames, paramNames, exceptionClassNames);
    }
  
    public void writeComment(String comment) throws IOException {
      mDest.writeComment(comment);
    }
  
    public void writeReturnStatement(Expression expression) throws IOException {
      mDest.writeReturnStatement(expression);
    }
  
    public void writeAssignmentStatement(Variable left, Expression right)
            throws IOException {
      mDest.writeAssignmentStatement(left, right);
    }
  
    public void endMethodOrConstructor() throws IOException {
      mDest.endMethodOrConstructor();
    }
  
    public void endClassOrInterface() throws IOException {
      mDest.endClassOrInterface();
    }
  
    public ExpressionFactory getExpressionFactory() {
      return mDest.getExpressionFactory();
    }
  
    public void close() throws IOException {
      mDest.close();
    }
  }
  
  
  1.1                  xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/joust/Variable.java
  
  Index: Variable.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  package org.apache.xmlbeans.impl.binding.joust;
  
  /**
   * An Expression which has the property of assignability.  This interface
   * simply ensures some basic correctness in the code generator.  Several
   * methods on JavaOutputStream (e.g. createMemberVariable) return instances of
   * Variable, and several other methods (e.g. writeAssignmentStatement) may
   * require a Variable as a parameter.
   *
   * @author Patrick Calahan <pcal@bea.com>
   */
  public interface Variable extends Expression {
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/joust/WriterFactory.java
  
  Index: WriterFactory.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  package org.apache.xmlbeans.impl.binding.joust;
  
  import java.io.IOException;
  import java.io.Writer;
  
  /**
   * SourceJavaOutputStream delegates to an instance of this interface when
   * it needs to get a Writer to write source code to.
   */
  public interface WriterFactory {
  
    public Writer createWriter(String packageName, String className)
            throws IOException;
  }
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org


Mime
View raw message