public class SQLiteConditionBuilder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MODEL_FIELD_END |
static java.lang.String |
MODEL_FIELD_START |
static java.lang.String |
WHERE |
static java.lang.String |
WHSP_STR |
Constructor and Description |
---|
SQLiteConditionBuilder() |
Modifier and Type | Method and Description |
---|---|
SQLiteConditionBuilder |
addArbitrarySQLExpression(java.lang.String ArbitrarySQLExp)
Adds any arbitrary item to condition
|
SQLiteConditionBuilder |
addColumn(java.lang.String columnName)
Adds column name to condition (e.g. ), if you want to use Java variables described
with
KITTY_COLUMN , use addField(String, Class) instead |
SQLiteConditionBuilder |
addField(java.lang.String fieldName,
java.lang.Class modelClass)
Adds column name associated with fieldName via
KITTY_COLUMN annotation
May throw KittyRuntimeException , which is just runtime exception,
if provided fieldName doesn't exists in provided modelClass or if
provided fieldName doesn't described with KITTY_COLUMN annotation |
SQLiteConditionBuilder |
addObjectValue(java.lang.Object value) |
SQLiteConditionBuilder |
addOperator(SQLiteOperator logic)
Adds some logic operators for SQL condition, described in
SQLiteOperator
SQLiteOperator has only common used operators, so, for something rare for
common logic use addArbitrarySQLExpression(String)
Alias for addSQLOperator(SQLiteOperator) |
SQLiteConditionBuilder |
addOperator(java.lang.String logic)
Adds some logic operators for SQL condition, described in
SQLiteOperator
SQLiteOperator has only common used operators, so, for something rare for
common logic use addArbitrarySQLExpression(String)
Case insensitive, so "and" and "AND" and even "AnD" is OK Alias for addSQLOperator(String) |
SQLiteConditionBuilder |
addSQLOperator(SQLiteOperator logic)
Adds some logic operators for SQL condition, described in
SQLiteOperator
SQLiteOperator has only common used operators, so, for something rare for
common logic use addArbitrarySQLExpression(String) |
SQLiteConditionBuilder |
addSQLOperator(java.lang.String logic)
Adds some logic operators for SQL condition, described in
SQLiteOperator
SQLiteOperator has only common used operators, so, for something rare for
common logic use addArbitrarySQLExpression(String)
Case insensitive, so "and" and "AND" and even "AnD" is OK |
SQLiteConditionBuilder |
addValue(boolean value) |
SQLiteConditionBuilder |
addValue(java.lang.Boolean value) |
SQLiteConditionBuilder |
addValue(byte value) |
SQLiteConditionBuilder |
addValue(java.lang.Byte value) |
SQLiteConditionBuilder |
addValue(double value) |
SQLiteConditionBuilder |
addValue(java.lang.Double value) |
SQLiteConditionBuilder |
addValue(float value) |
SQLiteConditionBuilder |
addValue(java.lang.Float value) |
SQLiteConditionBuilder |
addValue(int value) |
SQLiteConditionBuilder |
addValue(java.lang.Integer value) |
SQLiteConditionBuilder |
addValue(long value) |
SQLiteConditionBuilder |
addValue(java.lang.Long value) |
SQLiteConditionBuilder |
addValue(short value) |
SQLiteConditionBuilder |
addValue(java.lang.Short value) |
SQLiteConditionBuilder |
addValue(java.lang.String value) |
SQLiteCondition |
build()
Resets builder and return SQL condition
|
static SQLiteCondition |
fromSQL(java.lang.String conditionStr,
java.lang.Class<? extends KittyModel> modelClass,
java.lang.Object... params)
Generates
SQLiteCondition from SQLite string and provided params. |
java.lang.String |
getConditionSQLString()
Returns sql condition String set with setters
|
java.lang.String[] |
getConditionValues()
Returns string values to be used in prepared sql condition
|
void |
newSQLiteCondition()
Makes this builder ready for new sql condition
If you are crazy about memory usage optimization,
use
newSQLiteCondition(int)
for using buffer capacity you actually need |
void |
newSQLiteCondition(int conditionStringBufferCapacity)
Makes this builder ready for new sql condition
|
public static final java.lang.String WHERE
public static final java.lang.String MODEL_FIELD_START
public static final java.lang.String MODEL_FIELD_END
public static final java.lang.String WHSP_STR
public void newSQLiteCondition()
newSQLiteCondition(int)
for using buffer capacity you actually needpublic void newSQLiteCondition(int conditionStringBufferCapacity)
conditionStringBufferCapacity
- - size of StringBuffer
that would
be usedpublic SQLiteConditionBuilder addField(java.lang.String fieldName, java.lang.Class modelClass)
KITTY_COLUMN
annotation
May throw KittyRuntimeException
, which is just runtime exception,
if provided fieldName doesn't exists in provided modelClass or if
provided fieldName doesn't described with KITTY_COLUMN
annotationfieldName
- modelClass
- public SQLiteConditionBuilder addSQLOperator(SQLiteOperator logic)
SQLiteOperator
SQLiteOperator
has only common used operators, so, for something rare for
common logic use addArbitrarySQLExpression(String)
logic
- public SQLiteConditionBuilder addSQLOperator(java.lang.String logic)
SQLiteOperator
SQLiteOperator
has only common used operators, so, for something rare for
common logic use addArbitrarySQLExpression(String)
logic
- public SQLiteConditionBuilder addOperator(java.lang.String logic)
SQLiteOperator
SQLiteOperator
has only common used operators, so, for something rare for
common logic use addArbitrarySQLExpression(String)
addSQLOperator(String)
logic
- public SQLiteConditionBuilder addOperator(SQLiteOperator logic)
SQLiteOperator
SQLiteOperator
has only common used operators, so, for something rare for
common logic use addArbitrarySQLExpression(String)
addSQLOperator(SQLiteOperator)
logic
- public SQLiteConditionBuilder addColumn(java.lang.String columnName)
KITTY_COLUMN
, use addField(String, Class)
insteadcolumnName
- public SQLiteConditionBuilder addArbitrarySQLExpression(java.lang.String ArbitrarySQLExp)
ArbitrarySQLExp
- public SQLiteConditionBuilder addValue(java.lang.String value)
public SQLiteConditionBuilder addValue(java.lang.Boolean value)
public SQLiteConditionBuilder addValue(boolean value)
public SQLiteConditionBuilder addValue(int value)
public SQLiteConditionBuilder addValue(java.lang.Integer value)
public SQLiteConditionBuilder addValue(byte value)
public SQLiteConditionBuilder addValue(java.lang.Byte value)
public SQLiteConditionBuilder addValue(double value)
public SQLiteConditionBuilder addValue(java.lang.Double value)
public SQLiteConditionBuilder addValue(long value)
public SQLiteConditionBuilder addValue(java.lang.Long value)
public SQLiteConditionBuilder addValue(short value)
public SQLiteConditionBuilder addValue(java.lang.Short value)
public SQLiteConditionBuilder addValue(float value)
public SQLiteConditionBuilder addValue(java.lang.Float value)
public SQLiteConditionBuilder addObjectValue(java.lang.Object value)
public java.lang.String getConditionSQLString()
public java.lang.String[] getConditionValues()
public SQLiteCondition build()
public static final SQLiteCondition fromSQL(java.lang.String conditionStr, java.lang.Class<? extends KittyModel> modelClass, java.lang.Object... params)
SQLiteCondition
from SQLite string and provided params.
conditionStr
- SQLite condition string with ? placeholders for parametersmodelClass
- model class, required if you pass model field name instead column names using #?modelField; syntaxparams
- parameters to be used with querySQLiteCondition
from SQLite string and provided params.