nl.topicus.jdbc.shaded.net.sf.jsqlparser.expression.JsonExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spanner-jdbc Show documentation
Show all versions of spanner-jdbc Show documentation
JDBC Driver for Google Cloud Spanner
/*
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2014 JSQLParser
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
package nl.topicus.jdbc.shaded.net.sf.jsqlparser.expression;
import java.util.ArrayList;
import java.util.List;
import nl.topicus.jdbc.shaded.net.sf.jsqlparser.schema.Column;
/**
*
* @author toben
*/
public class JsonExpression implements Expression {
private Column column;
private List idents = new ArrayList();
private List operators = new ArrayList();
@Override
public void accept(ExpressionVisitor expressionVisitor) {
expressionVisitor.visit(this);
}
public Column getColumn() {
return column;
}
public void setColumn(Column column) {
this.column = column;
}
// public List getIdents() {
// return idents;
// }
//
// public void setIdents(List idents) {
// this.idents = idents;
// operators = new ArrayList();
// for (String ident : idents) {
// operators.add("->");
// }
// }
//
// public void addIdent(String ident) {
// addIdent(ident, "->");
// }
public void addIdent(String ident, String operator) {
idents.add(ident);
operators.add(operator);
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append(column.toString());
for (int i = 0; i < idents.size(); i++) {
b.append(operators.get(i)).append(idents.get(i));
}
return b.toString();
}
}