com.mysema.util
Class JavaWriter

java.lang.Object
  extended by com.mysema.util.JavaWriter
All Implemented Interfaces:
CodeWriter, Appendable

public class JavaWriter
extends Object
implements Appendable, CodeWriter

Author:
tiwe

Constructor Summary
JavaWriter(Appendable appendable)
           
 
Method Summary
 CodeWriter annotation(Annotation annotation)
           
 JavaWriter append(char c)
           
 JavaWriter append(CharSequence csq)
           
 JavaWriter append(CharSequence csq, int start, int end)
           
 CodeWriter beginClass(String simpleName, String superClass, String... interfaces)
           
<T> CodeWriter
beginConstructor(Collection<T> parameters, org.apache.commons.collections15.Transformer<T,String> transformer)
           
 CodeWriter beginConstructor(String... parameters)
           
 CodeWriter beginInterface(String simpleName, String... interfaces)
           
 CodeWriter beginLine(String... segments)
           
<T> CodeWriter
beginMethod(String returnType, String methodName, Collection<T> parameters, org.apache.commons.collections15.Transformer<T,String> transformer)
           
 CodeWriter beginMethod(String returnType, String methodName, String... args)
           
<T> CodeWriter
beginStaticMethod(String returnType, String methodName, Collection<T> parameters, org.apache.commons.collections15.Transformer<T,String> transformer)
           
 CodeWriter end()
           
 CodeWriter imports(Class<?>... imports)
           
 CodeWriter imports(Package... imports)
           
 CodeWriter javadoc(String... lines)
           
 String join(String prefix, String suffix, Iterable<String> args)
           
 String join(String prefix, String suffix, String... args)
           
 CodeWriter line(String... segments)
           
 CodeWriter lines(String... lines)
           
 CodeWriter nl()
           
 CodeWriter packageDecl(String packageName)
           
 CodeWriter privateStaticFinal(String type, String name, String value)
           
 CodeWriter protectedField(String type, String name)
           
 CodeWriter publicFinal(String type, String name)
           
 CodeWriter publicFinal(String type, String name, String value)
           
 CodeWriter publicStaticFinal(String type, String name, String value)
           
 CodeWriter staticimports(Class<?>... imports)
           
 CodeWriter suppressWarnings(String type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaWriter

public JavaWriter(Appendable appendable)
Method Detail

annotation

public CodeWriter annotation(Annotation annotation)
                      throws IOException
Specified by:
annotation in interface CodeWriter
Throws:
IOException

append

public JavaWriter append(char c)
                  throws IOException
Specified by:
append in interface Appendable
Throws:
IOException

append

public JavaWriter append(CharSequence csq)
                  throws IOException
Specified by:
append in interface Appendable
Throws:
IOException

append

public JavaWriter append(CharSequence csq,
                         int start,
                         int end)
                  throws IOException
Specified by:
append in interface Appendable
Throws:
IOException

beginClass

public CodeWriter beginClass(String simpleName,
                             String superClass,
                             String... interfaces)
                      throws IOException
Specified by:
beginClass in interface CodeWriter
Throws:
IOException

beginConstructor

public <T> CodeWriter beginConstructor(Collection<T> parameters,
                                       org.apache.commons.collections15.Transformer<T,String> transformer)
                            throws IOException
Specified by:
beginConstructor in interface CodeWriter
Throws:
IOException

beginConstructor

public CodeWriter beginConstructor(String... parameters)
                            throws IOException
Specified by:
beginConstructor in interface CodeWriter
Throws:
IOException

beginInterface

public CodeWriter beginInterface(String simpleName,
                                 String... interfaces)
                          throws IOException
Specified by:
beginInterface in interface CodeWriter
Throws:
IOException

beginLine

public CodeWriter beginLine(String... segments)
                     throws IOException
Specified by:
beginLine in interface CodeWriter
Throws:
IOException

beginMethod

public <T> CodeWriter beginMethod(String returnType,
                                  String methodName,
                                  Collection<T> parameters,
                                  org.apache.commons.collections15.Transformer<T,String> transformer)
                       throws IOException
Specified by:
beginMethod in interface CodeWriter
Throws:
IOException

beginMethod

public CodeWriter beginMethod(String returnType,
                              String methodName,
                              String... args)
                       throws IOException
Specified by:
beginMethod in interface CodeWriter
Throws:
IOException

beginStaticMethod

public <T> CodeWriter beginStaticMethod(String returnType,
                                        String methodName,
                                        Collection<T> parameters,
                                        org.apache.commons.collections15.Transformer<T,String> transformer)
                             throws IOException
Specified by:
beginStaticMethod in interface CodeWriter
Throws:
IOException

end

public CodeWriter end()
               throws IOException
Specified by:
end in interface CodeWriter
Throws:
IOException

imports

public CodeWriter imports(Class<?>... imports)
                   throws IOException
Specified by:
imports in interface CodeWriter
Throws:
IOException

imports

public CodeWriter imports(Package... imports)
                   throws IOException
Specified by:
imports in interface CodeWriter
Throws:
IOException

javadoc

public CodeWriter javadoc(String... lines)
                   throws IOException
Specified by:
javadoc in interface CodeWriter
Throws:
IOException

join

public String join(String prefix,
                   String suffix,
                   Iterable<String> args)
Specified by:
join in interface CodeWriter

join

public String join(String prefix,
                   String suffix,
                   String... args)
Specified by:
join in interface CodeWriter

line

public CodeWriter line(String... segments)
                throws IOException
Specified by:
line in interface CodeWriter
Throws:
IOException

lines

public CodeWriter lines(String... lines)
                 throws IOException
Specified by:
lines in interface CodeWriter
Throws:
IOException

nl

public CodeWriter nl()
              throws IOException
Specified by:
nl in interface CodeWriter
Throws:
IOException

packageDecl

public CodeWriter packageDecl(String packageName)
                       throws IOException
Specified by:
packageDecl in interface CodeWriter
Throws:
IOException

privateStaticFinal

public CodeWriter privateStaticFinal(String type,
                                     String name,
                                     String value)
                              throws IOException
Specified by:
privateStaticFinal in interface CodeWriter
Throws:
IOException

protectedField

public CodeWriter protectedField(String type,
                                 String name)
                          throws IOException
Specified by:
protectedField in interface CodeWriter
Throws:
IOException

publicFinal

public CodeWriter publicFinal(String type,
                              String name)
                       throws IOException
Specified by:
publicFinal in interface CodeWriter
Throws:
IOException

publicFinal

public CodeWriter publicFinal(String type,
                              String name,
                              String value)
                       throws IOException
Specified by:
publicFinal in interface CodeWriter
Throws:
IOException

publicStaticFinal

public CodeWriter publicStaticFinal(String type,
                                    String name,
                                    String value)
                             throws IOException
Specified by:
publicStaticFinal in interface CodeWriter
Throws:
IOException

staticimports

public CodeWriter staticimports(Class<?>... imports)
                         throws IOException
Specified by:
staticimports in interface CodeWriter
Throws:
IOException

suppressWarnings

public CodeWriter suppressWarnings(String type)
                            throws IOException
Specified by:
suppressWarnings in interface CodeWriter
Throws:
IOException


Copyright © 2007-2010 Mysema Ltd. All Rights Reserved.