improved odps sql formatter

This commit is contained in:
shaojin.wensj
2015-07-20 04:41:57 +08:00
parent 8f51368245
commit a5811a4f3e
38 changed files with 415 additions and 103 deletions
@@ -111,6 +111,10 @@ public abstract class SQLObjectImpl implements SQLObject {
@SuppressWarnings("unchecked")
public void addBeforeComment(String comment) {
if (comment == null) {
return;
}
if (attributes == null) {
attributes = new HashMap<String, Object>(1);
}
@@ -124,6 +128,20 @@ public abstract class SQLObjectImpl implements SQLObject {
comments.add(comment);
}
@SuppressWarnings("unchecked")
public void addBeforeComment(List<String> comments) {
if (attributes == null) {
attributes = new HashMap<String, Object>(1);
}
List<String> attrComments = (List<String>) attributes.get("format.before_comment");
if (attrComments == null) {
attributes.put("format.before_comment", comments);
} else {
attrComments.addAll(comments);
}
}
@SuppressWarnings("unchecked")
public List<String> getBeforeCommentsDirect() {
if (attributes == null) {
@@ -148,6 +166,20 @@ public abstract class SQLObjectImpl implements SQLObject {
comments.add(comment);
}
@SuppressWarnings("unchecked")
public void addAfterComment(List<String> comments) {
if (attributes == null) {
attributes = new HashMap<String, Object>(1);
}
List<String> attrComments = (List<String>) attributes.get("format.after_comment");
if (attrComments == null) {
attributes.put("format.after_comment", comments);
} else {
attrComments.addAll(comments);
}
}
@SuppressWarnings("unchecked")
public List<String> getAfterCommentsDirect() {
if (attributes == null) {