public class NumberConverter extends Object implements ValueConverter<Number>
Modifier and Type | Field and Description |
---|---|
private Constructor<? extends Number> |
stringConstructor |
Constructor and Description |
---|
NumberConverter(Class<? extends Number> type)
Creates a new instance of
NumberConverter . |
Modifier and Type | Method and Description |
---|---|
ColumnExpression |
getExpression(Number value,
GeneratorContext context)
Builds the expression for writing the given value into an SQL clause.
|
ColumnExpression |
getExpression(String defaultValue,
GeneratorContext context)
Builds the expression for writing the default value into an SQL clause.
|
private Constructor<? extends Number> stringConstructor
public NumberConverter(Class<? extends Number> type)
NumberConverter
.type
- the type of the numberModelException
- if the String constructor is missing from the given number classpublic ColumnExpression getExpression(Number value, GeneratorContext context)
ValueConverter
getExpression
in interface ValueConverter<Number>
value
- the current valuecontext
- the current context (contains the database dialect).public ColumnExpression getExpression(String defaultValue, GeneratorContext context)
ValueConverter
getExpression
in interface ValueConverter<Number>
defaultValue
- the default value, as given in an DefaultValue
expressioncontext
- the current context (contains the database dialect).Copyright © 2022 fastnate.org. All rights reserved.