From 8f8b2fcd98e366c42a2adee47c774ed9c67bf0d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Westk=C3=A4mper?= Date: Mon, 24 May 2010 21:03:08 +0000 Subject: [PATCH] extended CodeWriter signature --- .../java/com/mysema/codegen/CodeWriter.java | 180 ++---------------- .../java/com/mysema/codegen/JavaWriter.java | 20 ++ 2 files changed, 31 insertions(+), 169 deletions(-) diff --git a/src/main/java/com/mysema/codegen/CodeWriter.java b/src/main/java/com/mysema/codegen/CodeWriter.java index 24efd6695..c4fb5f643 100644 --- a/src/main/java/com/mysema/codegen/CodeWriter.java +++ b/src/main/java/com/mysema/codegen/CodeWriter.java @@ -19,226 +19,68 @@ import org.apache.commons.collections15.Transformer; */ public interface CodeWriter extends Appendable{ - /** - * @param annotation - * @return - * @throws IOException - */ CodeWriter annotation(Annotation annotation) throws IOException; - /** - * @param annotation - * @return - * @throws IOException - */ CodeWriter annotation(Class annotation) throws IOException; - /** - * @param simpleName - * @return - * @throws IOException - */ CodeWriter beginClass(String simpleName) throws IOException; - /** - * @param simpleName - * @param superClass - * @param interfaces - * @return - * @throws IOException - */ CodeWriter beginClass(String simpleName, String superClass, String... interfaces) throws IOException; - /** - * @param - * @param params - * @param transformer - * @return - * @throws IOException - */ CodeWriter beginConstructor(Collection params, Transformer transformer) throws IOException; - /** - * @param params - * @return - * @throws IOException - */ CodeWriter beginConstructor(String... params) throws IOException; - /** - * @param simpleName - * @param interfaces - * @return - * @throws IOException - */ CodeWriter beginInterface(String simpleName, String... interfaces) throws IOException; - /** - * @param - * @param returnType - * @param methodName - * @param parameters - * @param transformer - * @return - * @throws IOException - */ CodeWriter beginPublicMethod(String returnType, String methodName, Collection parameters, Transformer transformer) throws IOException; - /** - * @param returnType - * @param methodName - * @param args - * @return - * @throws IOException - */ CodeWriter beginPublicMethod(String returnType, String methodName, String... args) throws IOException; - /** - * @param - * @param type - * @param name - * @param params - * @param transformer - * @return - * @throws IOException - */ CodeWriter beginStaticMethod(String type, String name, Collection params, Transformer transformer) throws IOException; - /** - * @param returnType - * @param methodName - * @param args - * @return - * @throws IOException - */ CodeWriter beginStaticMethod(String returnType, String methodName, String... args) throws IOException; - /** - * @return - * @throws IOException - */ CodeWriter end() throws IOException; - /** - * @param type - * @param name - * @return - * @throws IOException - */ CodeWriter field(String type, String name) throws IOException; - /** - * @param imports - * @return - * @throws IOException - */ CodeWriter imports(Class... imports) throws IOException; - /** - * @param imports - * @return - * @throws IOException - */ CodeWriter imports(Package... imports) throws IOException; - /** - * @param lines - * @return - * @throws IOException - */ CodeWriter javadoc(String... lines) throws IOException; - /** - * @param segments - * @return - * @throws IOException - */ CodeWriter line(String... segments) throws IOException; - /** - * @return - * @throws IOException - */ CodeWriter nl() throws IOException; - /** - * @param packageName - * @return - * @throws IOException - */ CodeWriter packageDecl(String packageName) throws IOException; - - /** - * @param type - * @param name - * @return - * @throws IOException - */ + CodeWriter privateField(String type, String name) throws IOException; - /** - * @param type - * @param name - * @param value - * @return - * @throws IOException - */ + CodeWriter privateFinal(String type, String name) throws IOException; + + CodeWriter privateFinal(String type, String name, String value) throws IOException; + CodeWriter privateStaticFinal(String type, String name, String value) throws IOException; - - /** - * @param type - * @param name - * @return - * @throws IOException - */ + CodeWriter protectedField(String type, String name) throws IOException; - /** - * @param type - * @param name - * @return - * @throws IOException - */ - CodeWriter publicField(String type, String name) throws IOException; + CodeWriter protectedFinal(String type, String name) throws IOException; - /** - * @param type - * @param name - * @return - * @throws IOException - */ + CodeWriter protectedFinal(String type, String name, String value) throws IOException; + + CodeWriter publicField(String type, String name) throws IOException; + CodeWriter publicFinal(String type, String name) throws IOException; - /** - * @param type - * @param name - * @param value - * @return - * @throws IOException - */ CodeWriter publicFinal(String type, String name, String value) throws IOException; - /** - * @param type - * @param name - * @param value - * @return - * @throws IOException - */ CodeWriter publicStaticFinal(String type, String name, String value) throws IOException; - /** - * @param imports - * @return - * @throws IOException - */ CodeWriter staticimports(Class... imports) throws IOException; - /** - * @param type - * @return - * @throws IOException - */ CodeWriter suppressWarnings(String type) throws IOException; } \ No newline at end of file diff --git a/src/main/java/com/mysema/codegen/JavaWriter.java b/src/main/java/com/mysema/codegen/JavaWriter.java index b138de556..caaf8730c 100644 --- a/src/main/java/com/mysema/codegen/JavaWriter.java +++ b/src/main/java/com/mysema/codegen/JavaWriter.java @@ -334,6 +334,16 @@ public final class JavaWriter implements Appendable, CodeWriter{ return field(PRIVATE, type, name); } + @Override + public JavaWriter privateFinal(String type, String name) throws IOException { + return field(PRIVATE, type, name); + } + + @Override + public JavaWriter privateFinal(String type, String name, String value) throws IOException { + return field(PRIVATE, type, name, value); + } + @Override public JavaWriter privateStaticFinal(String type, String name, String value) throws IOException { return field(PRIVATE_STATIC_FINAL, type, name, value); @@ -343,6 +353,16 @@ public final class JavaWriter implements Appendable, CodeWriter{ public JavaWriter protectedField(String type, String name) throws IOException { return field(PROTECTED, type, name); } + + @Override + public JavaWriter protectedFinal(String type, String name) throws IOException { + return field(PROTECTED, type, name); + } + + @Override + public JavaWriter protectedFinal(String type, String name, String value) throws IOException { + return field(PROTECTED, type, name, value); + } @Override public JavaWriter publicField(String type, String name) throws IOException {