Skip to content

Make the "column" function of SqlColumn static #2

@tnicolas29200

Description

@tnicolas29200

Hello,

It'll be great if the column function of the SqlColumn class was static :

Personnaly, i prefer duplicate the "table" parameter on each call of column :
public static final SqlTable table = new SqlTable("table'); public final SqlColumn<Integer> id = SqlTable.column(table , "id", JDBCType.INTEGER); public final SqlColumn<String> firstName = SqlTable.column(table , "first_name", JDBCType.VARCHAR); public final SqlColumn<String> lastName = SqlTable.column(table , "last_name", JDBCType.VARCHAR); public final SqlColumn<Date> birthDate = SqlTable.column(table , "birth_date", JDBCType.DATE); public final SqlColumn<Boolean> employed = SqlTable.column(table , "employed", JDBCType.VARCHAR, "examples.simple.YesNoTypeHandler"); public final SqlColumn<String> occupation = SqlTable.column(table , "occupation", JDBCType.VARCHAR);

rather than dupliate all the field because the column function need "this" on the code for getting the table object :
`public static final SimpleTable simpleTable = new SimpleTable();
public static final SqlColumn id = simpleTable.id;
public static final SqlColumn firstName = simpleTable.firstName;
public static final SqlColumn lastName = simpleTable.lastName;
public static final SqlColumn birthDate = simpleTable.birthDate;
public static final SqlColumn employed = simpleTable.employed;
public static final SqlColumn occupation = simpleTable.occupation;

public static final class SimpleTable extends SqlTable {
    public final SqlColumn<Integer> id = column("id", JDBCType.INTEGER);
    public final SqlColumn<String> firstName = column("first_name", JDBCType.VARCHAR);
    public final SqlColumn<String> lastName = column("last_name", JDBCType.VARCHAR);
    public final SqlColumn<Date> birthDate = column("birth_date", JDBCType.DATE);
    public final SqlColumn<Boolean> employed = column("employed", JDBCType.VARCHAR, "examples.simple.YesNoTypeHandler");
    public final SqlColumn<String> occupation = column("occupation", JDBCType.VARCHAR);

    public SimpleTable() {
        super("SimpleTable");
    }
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions