forked from JSQLParser/JSqlParser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostgresNamedFunctionParameter.java
More file actions
55 lines (45 loc) · 1.45 KB
/
PostgresNamedFunctionParameter.java
File metadata and controls
55 lines (45 loc) · 1.45 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
45
46
47
48
49
50
51
52
53
54
55
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2021 JSQLParser
* %%
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
import java.util.Objects;
/**
* @author <a href="mailto:andreas@manticore-projects.com">Andreas Reichel</a>
*/
public class PostgresNamedFunctionParameter extends ASTNodeAccessImpl implements Expression {
private final String name;
private final Expression expression;
public PostgresNamedFunctionParameter(String name, Expression expression) {
this.name = Objects.requireNonNull(name,
"The NAME of the PostgresNamedFunctionParameter must not be null.");
this.expression = Objects.requireNonNull(expression,
"The EXPRESSION of the PostgresNamedFunctionParameter must not be null.");
}
public String getName() {
return name;
}
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(name)
.append(" := ")
.append(expression);
return builder;
}
@Override
public String toString() {
return appendTo(new StringBuilder()).toString();
}
}