Class PrimitiveColumnExpression<T>
java.lang.Object
org.fastnate.generator.statements.PrimitiveColumnExpression<T>
- Type Parameters:
T- the type of the primitive value
- All Implemented Interfaces:
ColumnExpression
A
ColumnExpression which contains a primitive value.- Author:
- Tobias Liefke
-
Field Summary
FieldsModifier and TypeFieldDescriptionConverts the primitive value to an SQL string.private final TThe primitive database value (which may be used in an prepared statement).static final PrimitiveColumnExpression<Object> Represents an expression of anullvalue.private final TThe original primitive value. -
Constructor Summary
ConstructorsConstructorDescriptionPrimitiveColumnExpression(T value, Function<T, String> converter) Creates a new instance of an expression where the original value is the database value.Creates a newPrimitiveColumnExpressioninstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic final PrimitiveColumnExpression<String> create(String value, GeneratorDialect dialect) Creates a new instance of aPrimitiveColumnExpressionfor a string.static final <N extends Number>
PrimitiveColumnExpression<N> create(N value, GeneratorDialect dialect) Creates a new instance ofPrimitiveColumnExpressionfor a number.Converts the primitive value to an SQL string.The primitive database value (which may be used in an prepared statement).getValue()The original primitive value.toSql()Generates the SQL for this expression.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.fastnate.generator.statements.ColumnExpression
appendSql
-
Field Details
-
NULL
Represents an expression of anullvalue. -
value
The original primitive value. -
databaseValue
The primitive database value (which may be used in an prepared statement). -
converter
Converts the primitive value to an SQL string.
-
-
Constructor Details
-
PrimitiveColumnExpression
Creates a new instance of an expression where the original value is the database value.- Parameters:
value- the primitive valueconverter- converts the primitive value to an SQL string
-
PrimitiveColumnExpression
Creates a newPrimitiveColumnExpressioninstance.- Parameters:
value- The original primitive value.databaseValue- The primitive database value (which may be used in an prepared statement).converter- Converts the primitive value to an SQL string.
-
-
Method Details
-
create
public static final <N extends Number> PrimitiveColumnExpression<N> create(N value, GeneratorDialect dialect) Creates a new instance ofPrimitiveColumnExpressionfor a number.- Parameters:
value- the number valuedialect- the dialect of the current database- Returns:
- the new expression
-
create
public static final PrimitiveColumnExpression<String> create(String value, GeneratorDialect dialect) Creates a new instance of aPrimitiveColumnExpressionfor a string.- Parameters:
value- the string valuedialect- the dialect of the current database- Returns:
- the new expression
-
toSql
Description copied from interface:ColumnExpressionGenerates the SQL for this expression.- Specified by:
toSqlin interfaceColumnExpression- Returns:
- the SQL string
-
toString
-
getValue
The original primitive value. -
getDatabaseValue
The primitive database value (which may be used in an prepared statement). -
getConverter
Converts the primitive value to an SQL string.
-