forked from JSQLParser/JSqlParser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyExpression.java
More file actions
44 lines (37 loc) · 1.12 KB
/
KeyExpression.java
File metadata and controls
44 lines (37 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2026 JSQLParser
* %%
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
import java.util.Objects;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
/**
* Dialect specific expression for constructs such as {@code KEY chain.entity}.
*/
public class KeyExpression extends ASTNodeAccessImpl implements Expression {
private final Expression expression;
public KeyExpression(Expression expression) {
this.expression = Objects.requireNonNull(expression,
"The EXPRESSION of the KEY expression must not be null");
}
public Expression getExpression() {
return expression;
}
@Override
public <T, S> T accept(ExpressionVisitor<T> expressionVisitor, S context) {
return expressionVisitor.visit(this, context);
}
public StringBuilder appendTo(StringBuilder builder) {
builder.append("KEY ").append(expression);
return builder;
}
@Override
public String toString() {
return appendTo(new StringBuilder()).toString();
}
}