Package com.github.eikecochu.sqlbuilder
Class Conditionable<T extends Conditionable<T>>
- java.lang.Object
-
- com.github.eikecochu.sqlbuilder.QueryPartImpl<T>
-
- com.github.eikecochu.sqlbuilder.Conditionable<T>
-
- Type Parameters:
T- The type which allows setting conditions
- All Implemented Interfaces:
QueryPart
public abstract class Conditionable<T extends Conditionable<T>> extends QueryPartImpl<T>
Abstract base class for condition like statements, generic to allow multiple origins, for example from WHERE, JOIN etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConditionable.Operator
-
Constructor Summary
Constructors Modifier Constructor Description Conditionable()protectedConditionable(QueryPart parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tand()Connect the previous and next condition with the AND operatorConditionPart<T>col(java.lang.String name)Use a column as constraintTcol(java.lang.String name, java.lang.Object value)Compare a column to a valueTcol(java.lang.String name, java.lang.Object... values)Compare a column to multiple valuesTgroup(Condition group)Include a subgroup in the conditionNestedCondition<T>groupStart()Start a nested condition groupTor()Connect the previous and next condition with the OR operatorjava.lang.Stringstring(QueryOptions options)Transforms this statement into an SQL stringTvalues(ValueHolder values)Set the comparing values-
Methods inherited from class com.github.eikecochu.sqlbuilder.QueryPartImpl
ext, parent, sql
-
-
-
-
Constructor Detail
-
Conditionable
public Conditionable()
-
Conditionable
protected Conditionable(QueryPart parent)
-
-
Method Detail
-
values
public T values(ValueHolder values)
Set the comparing values- Parameters:
values- The comparing values- Returns:
- This instance
-
col
public ConditionPart<T> col(java.lang.String name)
Use a column as constraint- Parameters:
name- The column name- Returns:
- The value instance to set the compare value
-
col
public T col(java.lang.String name, java.lang.Object value)
Compare a column to a value- Parameters:
name- The column namevalue- The comparing value- Returns:
- This instance
-
col
public T col(java.lang.String name, java.lang.Object... values)
Compare a column to multiple values- Parameters:
name- The column namevalues- The comparing values- Returns:
- This instance
-
group
public T group(Condition group)
Include a subgroup in the condition- Parameters:
group- The subgroup- Returns:
- This instance
-
groupStart
public NestedCondition<T> groupStart()
Start a nested condition group- Returns:
- The new nested condition group
-
and
public T and()
Connect the previous and next condition with the AND operator- Returns:
- This instance
-
or
public T or()
Connect the previous and next condition with the OR operator- Returns:
- This instance
-
string
public java.lang.String string(QueryOptions options)
Description copied from interface:QueryPartTransforms this statement into an SQL string- Parameters:
options- The QueryOptions to apply for transformation- Returns:
- The created SQL string
-
-