
org.fastnate.generator.converter.BooleanConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fastnate-generator Show documentation
Show all versions of fastnate-generator Show documentation
The Fastnate Offline SQL Generator
The newest version!
package org.fastnate.generator.converter;
import org.fastnate.generator.context.GeneratorContext;
import org.fastnate.generator.statements.ColumnExpression;
import org.fastnate.generator.statements.PrimitiveColumnExpression;
/**
* Converts a boolean to a SQL expression.
*
* @author Tobias Liefke
*/
public class BooleanConverter implements ValueConverter {
@Override
public ColumnExpression getExpression(final Boolean value, final GeneratorContext context) {
return new PrimitiveColumnExpression<>(value, context.getDialect()::convertBooleanValue);
}
@Override
public ColumnExpression getExpression(final String defaultValue, final GeneratorContext context) {
return getExpression(defaultValue.equals("true") || defaultValue.equals("1"), context);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy