提交 6f2a2af9 authored 作者: Thomas Mueller's avatar Thomas Mueller

Formatting.

上级 9549cb57
...@@ -269,7 +269,7 @@ class TableDefinition<T> { ...@@ -269,7 +269,7 @@ class TableDefinition<T> {
/** /**
* Optionally truncates strings to the maximum length * Optionally truncates strings to the maximum length
*/ */
private Object getValue(Object obj, FieldDefinition field) { private static Object getValue(Object obj, FieldDefinition field) {
Object value = field.getValue(obj); Object value = field.getValue(obj);
if (field.trimString && field.maxLength > 0) { if (field.trimString && field.maxLength > 0) {
if (value instanceof String) { if (value instanceof String) {
...@@ -499,7 +499,7 @@ class TableDefinition<T> { ...@@ -499,7 +499,7 @@ class TableDefinition<T> {
* @param index the index columns, separated by space * @param index the index columns, separated by space
* @return the column list * @return the column list
*/ */
private List<String> getColumns(String index) { private static List<String> getColumns(String index) {
List<String> cols = New.arrayList(); List<String> cols = New.arrayList();
if (index == null || index.length() == 0) { if (index == null || index.length() == 0) {
return null; return null;
......
...@@ -40,7 +40,8 @@ import static org.h2.jaqu.ValidationRemark.warn; ...@@ -40,7 +40,8 @@ import static org.h2.jaqu.ValidationRemark.warn;
*/ */
public class TableInspector { public class TableInspector {
private final static int todoReviewClass = 0; private static final int todoReviewClass = 0;
private static final String EOL = "\n";
private final String schema; private final String schema;
private final String table; private final String table;
...@@ -49,7 +50,6 @@ public class TableInspector { ...@@ -49,7 +50,6 @@ public class TableInspector {
private final List<String> primaryKeys = New.arrayList(); private final List<String> primaryKeys = New.arrayList();
private Map<String, IndexInspector> indexes; private Map<String, IndexInspector> indexes;
private Map<String, ColumnInspector> columns; private Map<String, ColumnInspector> columns;
private static final String eol = "\n";
TableInspector(String schema, String table, boolean forceUpperCase, TableInspector(String schema, String table, boolean forceUpperCase,
Class<? extends java.util.Date> dateTimeClass) { Class<? extends java.util.Date> dateTimeClass) {
...@@ -180,16 +180,16 @@ public class TableInspector { ...@@ -180,16 +180,16 @@ public class TableInspector {
if (!StringUtils.isNullOrEmpty(packageName)) { if (!StringUtils.isNullOrEmpty(packageName)) {
// package // package
model.append("package " + packageName + ";"); model.append("package " + packageName + ";");
model.append(eol).append(eol); model.append(EOL).append(EOL);
} }
// imports // imports
List<String> sortedImports = new ArrayList<String>(imports); List<String> sortedImports = new ArrayList<String>(imports);
Collections.sort(sortedImports); Collections.sort(sortedImports);
for (String imp : sortedImports) { for (String imp : sortedImports) {
model.append("import ").append(imp).append(';').append(eol); model.append("import ").append(imp).append(';').append(EOL);
} }
model.append(eol); model.append(EOL);
// @JQSchema // @JQSchema
if (annotateSchema && !StringUtils.isNullOrEmpty(schema)) { if (annotateSchema && !StringUtils.isNullOrEmpty(schema)) {
...@@ -198,7 +198,7 @@ public class TableInspector { ...@@ -198,7 +198,7 @@ public class TableInspector {
AnnotationBuilder ap = new AnnotationBuilder(); AnnotationBuilder ap = new AnnotationBuilder();
ap.addParameter("name", schema); ap.addParameter("name", schema);
model.append(ap); model.append(ap);
model.append(')').append(eol); model.append(')').append(EOL);
} }
// @JQTable // @JQTable
...@@ -220,7 +220,7 @@ public class TableInspector { ...@@ -220,7 +220,7 @@ public class TableInspector {
// finish @JQTable annotation // finish @JQTable annotation
model.append(ap); model.append(ap);
model.append(')').append(eol); model.append(')').append(EOL);
// @JQIndex // @JQIndex
ap = new AnnotationBuilder(); ap = new AnnotationBuilder();
...@@ -232,20 +232,20 @@ public class TableInspector { ...@@ -232,20 +232,20 @@ public class TableInspector {
model.append('@').append(JQIndex.class.getSimpleName()); model.append('@').append(JQIndex.class.getSimpleName());
model.append('('); model.append('(');
model.append(ap); model.append(ap);
model.append(')').append(eol); model.append(')').append(EOL);
} }
// class declaration // class declaration
String clazzName = ModelUtils.convertTableToClassName(table); String clazzName = ModelUtils.convertTableToClassName(table);
model.append(MessageFormat.format("public class {0} '{'", clazzName)).append(eol); model.append(MessageFormat.format("public class {0} '{'", clazzName)).append(EOL);
model.append(eol); model.append(EOL);
// field declarations // field declarations
model.append(fields); model.append(fields);
// default constructor // default constructor
model.append("\t" + "public ").append(clazzName).append("() {").append(eol); model.append("\t" + "public ").append(clazzName).append("() {").append(EOL);
model.append("\t}").append(eol); model.append("\t}").append(EOL);
// end of class body // end of class body
model.append('}'); model.append('}');
...@@ -348,7 +348,7 @@ public class TableInspector { ...@@ -348,7 +348,7 @@ public class TableInspector {
} }
sb.append(ap.toString()); sb.append(ap.toString());
} }
sb.append(eol); sb.append(EOL);
// variable declaration // variable declaration
sb.append("\t" + "public "); sb.append("\t" + "public ");
...@@ -356,7 +356,7 @@ public class TableInspector { ...@@ -356,7 +356,7 @@ public class TableInspector {
sb.append(' '); sb.append(' ');
sb.append(column); sb.append(column);
sb.append(';'); sb.append(';');
sb.append(eol).append(eol); sb.append(EOL).append(EOL);
return sb; return sb;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论