net.sf.jsqlparser.schema.Partition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsqlparser Show documentation
Show all versions of jsqlparser Show documentation
JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes.
The generated hierarchy can be navigated using the Visitor Pattern.
The newest version!
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2025 JSQLParser
* %%
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.schema;
import net.sf.jsqlparser.expression.Expression;
import java.util.Collection;
import java.util.Objects;
public class Partition {
protected Column column;
protected Expression value;
public Partition() {
}
public Partition(Column column, Expression value) {
this.column = column;
this.value = value;
}
public static void appendPartitionsTo(StringBuilder builder,
Collection partitions) {
int j = 0;
for (Partition partition : partitions) {
partition.appendTo(builder, j);
j++;
}
}
public Column getColumn() {
return column;
}
public void setColumn(Column column) {
this.column = Objects.requireNonNull(column);
}
public Expression getValue() {
return value;
}
public void setValue(Expression value) {
this.value = Objects.requireNonNull(value);
}
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPath"})
void appendTo(StringBuilder builder, int j) {
if (j > 0) {
builder.append(", ");
}
builder.append(column.getColumnName());
if (value != null) {
builder.append(" = ").append(value);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy