MCPcopy
hub / github.com/alibaba/druid / SQLObjectImpl

Class SQLObjectImpl

core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:31–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29import java.util.Map;
30
31public abstract class SQLObjectImpl implements SQLObject {
32 protected SQLObject parent;
33 protected Map<String, Object> attributes;
34 protected SQLCommentHint hint;
35
36 protected int sourceLine;
37 protected int sourceColumn;
38
39 public SQLObjectImpl() {
40 }
41
42 protected void cloneTo(SQLObjectImpl x) {
43 x.parent = this.parent;
44 if (this.attributes != null) {
45 x.attributes = new HashMap<>(attributes);
46 }
47 x.sourceLine = this.sourceLine;
48 x.sourceColumn = this.sourceColumn;
49 }
50
51 public final void accept(SQLASTVisitor visitor) {
52 if (visitor == null) {
53 throw new IllegalArgumentException();
54 }
55
56 visitor.preVisit(this);
57
58 accept0(visitor);
59
60 visitor.postVisit(this);
61 }
62
63 protected abstract void accept0(SQLASTVisitor v);
64
65 protected final void acceptChild(SQLASTVisitor visitor, List<? extends SQLObject> children) {
66 if (children == null) {
67 return;
68 }
69
70 for (int i = 0; i < children.size(); i++) {
71 acceptChild(visitor, children.get(i));
72 }
73 }
74
75 protected final void acceptChild(SQLASTVisitor visitor, SQLObject child) {
76 if (child == null) {
77 return;
78 }
79
80 child.accept(visitor);
81 }
82
83 public void output(StringBuilder buf) {
84 DbType dbType = null;
85 if (this instanceof OracleSQLObject) {
86 dbType = DbType.oracle;
87 } else if (this instanceof MySqlObject) {
88 dbType = DbType.mysql;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected