Class DbEntity
- java.lang.Object
-
- com.feedzai.commons.sql.abstraction.ddl.DbEntity
-
- All Implemented Interfaces:
Serializable
public class DbEntity extends Object implements Serializable
Represents a database entity.- Since:
- 2.0.0
- Author:
- Rui Vilao (rui.vilao@feedzai.com)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDbEntity.BuilderBuilder to create immutableDbEntityobjects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsColumn(String columnName)Checks if the given column is present in the list of columns.List<DbColumn>getColumns()Gets the list of columns of the entity.List<DbFk>getFks()Gets the immutable list of foreign keys.List<DbIndex>getIndexes()Gets the immutable list of indexes.StringgetName()Gets the name of the entity.List<String>getPkFields()Gets the immutable list of fields that compose the primary key.DbEntity.BuildernewBuilder()Returns a new builder out of the configuration.
-
-
-
Constructor Detail
-
DbEntity
protected DbEntity(String name, List<DbColumn> columns, List<DbFk> fks, List<String> pkFields, List<DbIndex> indexes)
Creates a new instance ofDbEntity.- Parameters:
name- The name of the entity.columns- The column that compose the entity.fks- The list of foreign keys.pkFields- The list of fields that compose the primary key.indexes- The list of indexes in the entity.
-
-
Method Detail
-
getName
public String getName()
Gets the name of the entity.- Returns:
- The name of the entity.
-
getColumns
public List<DbColumn> getColumns()
Gets the list of columns of the entity.- Returns:
- The list of columns of the entity.
-
getFks
public List<DbFk> getFks()
Gets the immutable list of foreign keys.- Returns:
- The immutable list of foreign keys.
-
getPkFields
public List<String> getPkFields()
Gets the immutable list of fields that compose the primary key.- Returns:
- The immutable list of keys that compose the primary key.
-
getIndexes
public List<DbIndex> getIndexes()
Gets the immutable list of indexes.- Returns:
- The immutable list of indexes.
-
containsColumn
public boolean containsColumn(String columnName)
Checks if the given column is present in the list of columns.- Parameters:
columnName- The column name to check.- Returns:
trueif the column is present in the list of columns,falseotherwise.
-
newBuilder
public DbEntity.Builder newBuilder()
Returns a new builder out of the configuration.- Returns:
- A new builder out of the configuration.
-
-