mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved odps sql formatter
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user