de.jaggl.sqlbuilder.columns.string.StringColumnBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sqlbuilder-core Show documentation
Show all versions of sqlbuilder-core Show documentation
A Java-Library to build SQL-Statements
package de.jaggl.sqlbuilder.columns.string;
import de.jaggl.sqlbuilder.columns.Column;
import de.jaggl.sqlbuilder.columns.ColumnBuilder;
import de.jaggl.sqlbuilder.columns.configurable.DefaultValueColumnBuilder;
import de.jaggl.sqlbuilder.columns.configurable.NullableColumnBuilder;
import de.jaggl.sqlbuilder.schema.Table;
/**
* @author Martin Schumacher
*
* @since 2.0.0
*/
public abstract class StringColumnBuilder, C extends Column> extends ColumnBuilder
implements NullableColumnBuilder, DefaultValueColumnBuilder
{
protected boolean isNullable = true;
protected boolean isDefaultNull = true;
protected CharSequence defaultValue;
public StringColumnBuilder(Table table, String name)
{
super(table, name);
}
@SuppressWarnings("unchecked")
@Override
public T nullable(boolean nullable)
{
isNullable = nullable;
return (T) this;
}
@SuppressWarnings("unchecked")
@Override
public T defaultValue(CharSequence value)
{
isDefaultNull = false;
defaultValue = value;
return (T) this;
}
@SuppressWarnings("unchecked")
@Override
public T defaultNull()
{
isNullable = true;
defaultValue = null;
isDefaultNull = true;
return (T) this;
}
@SuppressWarnings("unchecked")
@Override
public T noDefault()
{
defaultValue = null;
isDefaultNull = false;
return (T) this;
}
}