public static class DbEntity.Builder extends Object implements Builder<DbEntity>, Serializable
DbEntity
objects.Modifier and Type | Field and Description |
---|---|
protected List<DbColumn> |
columns |
protected List<DbFk> |
fks |
protected List<DbIndex> |
indexes |
protected String |
name |
protected List<String> |
pkFields |
Constructor and Description |
---|
DbEntity.Builder() |
Modifier and Type | Method and Description |
---|---|
DbEntity.Builder |
addColumn(Collection<DbColumn> dbColumn)
Adds the columns to the entity.
|
DbEntity.Builder |
addColumn(DbColumn dbColumn)
Adds a column to the entity.
|
DbEntity.Builder |
addColumn(String name,
DbColumnType type,
boolean autoInc,
DbColumnConstraint... constraints)
Adds a column to the entity.
|
DbEntity.Builder |
addColumn(String name,
DbColumnType type,
DbColumnConstraint... constraints)
Adds a column to the entity.
|
DbEntity.Builder |
addColumn(String name,
DbColumnType type,
Integer size,
boolean autoInc,
DbColumnConstraint... constraints)
Adds a column to the entity.
|
DbEntity.Builder |
addColumn(String name,
DbColumnType type,
Integer size,
DbColumnConstraint... constraints)
Adds a column to the entity.
|
DbEntity.Builder |
addColumn(String name,
DbColumnType type,
K defaultValue,
DbColumnConstraint... constraints)
Adds a column to the entity.
|
DbEntity.Builder |
addFk(Collection<DbFk> fks)
Adds the FKs.
|
DbEntity.Builder |
addFk(DbFk... fks)
Adds the FKs.
|
DbEntity.Builder |
addFk(DbFk.Builder... fks)
Adds the FKs.
|
DbEntity.Builder |
addFks(Collection<DbFk> fks)
Adds the FKs.
|
DbEntity.Builder |
addIndex(boolean unique,
String... columns)
Adds an index.
|
DbEntity.Builder |
addIndex(Collection<String> columns)
Adds an index.
|
DbEntity.Builder |
addIndex(DbIndex index)
Adds an index.
|
DbEntity.Builder |
addIndex(String... columns)
Adds an index.
|
DbEntity.Builder |
addIndexes(Collection<DbIndex> indexes)
Adds an index.
|
DbEntity |
build()
Builds the final immutable instance.
|
DbEntity.Builder |
clearFks()
Clears all the FKs in this builder.
|
DbEntity.Builder |
name(String name)
Sets the entity name.
|
DbEntity.Builder |
pkFields(Collection<String> pkFields)
Sets the PK fields.
|
DbEntity.Builder |
pkFields(String... pkFields)
Sets the PK fields.
|
DbEntity.Builder |
removeColumn(String name)
Removes the column with the given name.
|
protected String name
public DbEntity.Builder name(String name)
name
- The entity name.public DbEntity.Builder addColumn(DbColumn dbColumn)
dbColumn
- The column to add.public DbEntity.Builder removeColumn(String name)
name
- The column name to remove.public DbEntity.Builder addColumn(Collection<DbColumn> dbColumn)
dbColumn
- The columns to add.public DbEntity.Builder addColumn(String name, DbColumnType type, DbColumnConstraint... constraints)
name
- The entity name.type
- The entity type.constraints
- The list of constraints.public DbEntity.Builder addColumn(String name, DbColumnType type, Integer size, DbColumnConstraint... constraints)
name
- The entity name.type
- The entity type.size
- The type size.constraints
- The list of constraints.public DbEntity.Builder addColumn(String name, DbColumnType type, boolean autoInc, DbColumnConstraint... constraints)
name
- The entity name.type
- The entity type.autoInc
- true
if the column is to autoincrement, false
otherwise.constraints
- The list of constraints.public DbEntity.Builder addColumn(String name, DbColumnType type, K defaultValue, DbColumnConstraint... constraints)
name
- The entity name.type
- The entity type.defaultValue
- The defaultValue for the column.constraints
- The list of constraints.public DbEntity.Builder addColumn(String name, DbColumnType type, Integer size, boolean autoInc, DbColumnConstraint... constraints)
name
- The entity name.type
- The entity type.size
- The type size.autoInc
- True if the column is to autoincrement, false otherwise.constraints
- The list of constraints.public DbEntity.Builder pkFields(String... pkFields)
pkFields
- The PK fields.public DbEntity.Builder pkFields(Collection<String> pkFields)
pkFields
- The PK fields.public DbEntity.Builder addIndex(DbIndex index)
index
- The index.public DbEntity.Builder addIndexes(Collection<DbIndex> indexes)
indexes
- The index.public DbEntity.Builder addIndex(boolean unique, String... columns)
unique
- true
if the index is unique, false
otherwise.columns
- The columns that are part of the index.public DbEntity.Builder addIndex(String... columns)
columns
- The columns that are part of the index.public DbEntity.Builder addIndex(Collection<String> columns)
columns
- The columns that are part of the index.public DbEntity.Builder addFk(DbFk... fks)
fks
- The list of FKs.public DbEntity.Builder addFk(DbFk.Builder... fks)
fks
- The list FKs builders..public DbEntity.Builder addFk(Collection<DbFk> fks)
fks
- The list of FKs.public DbEntity.Builder clearFks()
public DbEntity.Builder addFks(Collection<DbFk> fks)
fks
- The list of FKs.Copyright © 2014 Feedzai. All Rights Reserved.