de.ec.sql.OrderByTerm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sqlbuilder Show documentation
Show all versions of sqlbuilder Show documentation
Java builder to create SQL statements
package de.ec.sql;
import lombok.AccessLevel;
import lombok.Getter;
@Getter(AccessLevel.PROTECTED)
public class OrderByTerm implements QueryPart {
private final Name name;
private final boolean ascending;
protected OrderByTerm(final String name, final boolean ascending) {
this(null, name, ascending);
}
protected OrderByTerm(final String schema, final String name, final boolean ascending) {
this.name = new Name().schema(schema)
.name(name);
this.ascending = ascending;
}
@Override
public String string(final QueryOptions options) {
return name.string(options) + " " + options.cased(ascending ? "ASC" : "DESC");
}
}