Class ColumnDefBuilder
- java.lang.Object
-
- org.linuxforhealth.fhir.database.utils.model.ColumnDefBuilder
-
public class ColumnDefBuilder extends java.lang.Object
Builder pattern to make it easy to add column definitions to an object (e.g. table, type etc)
-
-
Constructor Summary
Constructors Constructor Description ColumnDefBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnDefBuilder
addBigIntColumn(java.lang.String columnName, boolean nullable)
ColumnDefBuilder
addBigIntColumn(java.lang.String columnName, boolean nullable, java.lang.String defaultValue)
ColumnDefBuilder
addBlobColumn(java.lang.String columnName, long size, int inlineSize, boolean nullable)
ColumnDefBuilder
addCharColumn(java.lang.String columnName, int size, boolean nullable)
Add char (fixed-width) columnColumnDefBuilder
addCharColumn(java.lang.String columnName, int size, boolean nullable, java.lang.String defaultValue)
Add char (fixed-width) column with a default valueColumnDefBuilder
addDoubleColumn(java.lang.String columnName, boolean nullable)
ColumnDefBuilder
addIntColumn(java.lang.String columnName, boolean nullable)
ColumnDefBuilder
addSmallIntColumn(java.lang.String columnName, java.lang.Integer defaultValue, boolean nullable)
ColumnDefBuilder
addTimestampColumn(java.lang.String columnName, boolean nullable)
ColumnDefBuilder
addTimestampColumn(java.lang.String columnName, boolean nullable, java.lang.String defaultValue)
ColumnDefBuilder
addVarcharColumn(java.lang.String columnName, int size, boolean nullable)
java.util.List<ColumnBase>
buildColumns()
Create the columns for the table based on the definitions that have been addedstatic ColumnDefBuilder
builder()
Factory function to create a new instance of this buildervoid
checkColumnAlreadyExists(ColumnDef cd, java.lang.String columnName)
protected void
checkColumns(java.lang.String[] columns)
Check each of the columns in the given array are valid column namesprotected void
checkColumns(java.util.Collection<java.lang.String> columns)
Check each of the columns in the given array are valid column names
-
-
-
Field Detail
-
columns
protected java.util.LinkedHashSet<ColumnDef> columns
-
-
Method Detail
-
checkColumnAlreadyExists
public void checkColumnAlreadyExists(ColumnDef cd, java.lang.String columnName)
-
builder
public static ColumnDefBuilder builder()
Factory function to create a new instance of this builder- Returns:
-
addIntColumn
public ColumnDefBuilder addIntColumn(java.lang.String columnName, boolean nullable)
-
addSmallIntColumn
public ColumnDefBuilder addSmallIntColumn(java.lang.String columnName, java.lang.Integer defaultValue, boolean nullable)
-
addBigIntColumn
public ColumnDefBuilder addBigIntColumn(java.lang.String columnName, boolean nullable)
-
addBigIntColumn
public ColumnDefBuilder addBigIntColumn(java.lang.String columnName, boolean nullable, java.lang.String defaultValue)
-
addDoubleColumn
public ColumnDefBuilder addDoubleColumn(java.lang.String columnName, boolean nullable)
-
addTimestampColumn
public ColumnDefBuilder addTimestampColumn(java.lang.String columnName, boolean nullable)
-
addTimestampColumn
public ColumnDefBuilder addTimestampColumn(java.lang.String columnName, boolean nullable, java.lang.String defaultValue)
-
addVarcharColumn
public ColumnDefBuilder addVarcharColumn(java.lang.String columnName, int size, boolean nullable)
-
addCharColumn
public ColumnDefBuilder addCharColumn(java.lang.String columnName, int size, boolean nullable)
Add char (fixed-width) column- Parameters:
columnName
-size
-nullable
-- Returns:
-
addCharColumn
public ColumnDefBuilder addCharColumn(java.lang.String columnName, int size, boolean nullable, java.lang.String defaultValue)
Add char (fixed-width) column with a default value- Parameters:
columnName
-size
-nullable
-- Returns:
-
addBlobColumn
public ColumnDefBuilder addBlobColumn(java.lang.String columnName, long size, int inlineSize, boolean nullable)
-
checkColumns
protected void checkColumns(java.lang.String[] columns)
Check each of the columns in the given array are valid column names- Parameters:
columns
-
-
checkColumns
protected void checkColumns(java.util.Collection<java.lang.String> columns)
Check each of the columns in the given array are valid column names- Parameters:
columns
-
-
buildColumns
public java.util.List<ColumnBase> buildColumns()
Create the columns for the table based on the definitions that have been added- Returns:
-
-