Unique name and type

Daobab Column is a base interface, representing DataBase column, being a part of table.

Each column, identified by name and type has own interface created. Entity class inretites as many column interfaces as the related database table has column.

This construction help to recreate the relations between tables. For example when a table has a PrimaryKey and an other table has a ForeignKey to first table, both inherites the same column.

Column interface exposes proper getter and setter to the column value.

Each column-related table is generated by Daobab generator. Contains an unique name and is located into column package.

Apart of getter and setter, the interface expose a method with 'col' prefix which provides a cached object describing the real column and Java related objects such as:

  1. DataBase column name
    The real database column name
  2. Java field name
    Name used as a key into internal Map containing the entity fields.
  3. Object Type
    Class Type for column values
  4. Relation to Entity
    Which Entity contains the column.
    This information is generic, provided through Class type during Entity initialisation.

public interface Name<E extends EntityMap, F> extends EntityRelationMap<E> {

default F getName() {
return getColumnParam("Name");

default E setName(F val) {
"Name", val);
return (E) this;

default Column<E, F, Name> colName() {
return new Column<E, F, Name>() {

public String getColumnName() {
return "NAME";

public String getFieldName() {
return "Name";

public E getInstance(){
return getEntity();

public Class getFieldClass() {
return String.class;

public F getValue(Name entity) {
if (entity == null) throw new AttemptToReadFromNullEntityException(getEntityClass(), "Name");
return (F) entity.getName();

public void setValue(Name entity, F param) {
if (entity == null) throw new AttemptToWriteIntoNullEntityException(getEntityClass(), "Name");

public int hashCode() {
return toString().hashCode();

public String toString(){
return getEntityName()+"."+getFieldName();

public boolean equals(Object obj) {
if (this == obj)return true;
if (obj == null)return false;
if (getClass() != obj.getClass())return false;
                Column other = (Column) obj;
return Objects.equals(hashCode(), other.hashCode());



© Copyright 2018-2023 Elephant Software Klaudiusz Wojtkowiak