Hi all,
Using the package org.apache.ddlutils.model a few questions came to my
mind. The classes (i.e. Database, Table, Column) follow the JavaBean
structure (setters, getters, no-argument-constructor). That's quite
ok, but it has its consequences:
1. new Column() is possible but is an inconsistent object possibly
(actually seen) causing (NullPointer)Exceptions in the library. How
about adding more constructors, like Column(String name)?
2. The following
Column c;
Table t = new Table();
t.setName("Meta");
c = new Column();
c.setName("type");
c.setType(TypeMap.VARCHAR);
c.setPrimaryKey(true);
c.setSize("2048");
t.addColumn(c);
c = new Column();
c.setName("super");
c.setType(TypeMap.VARCHAR);
c.setSize("2048");
t.addColumn(c);
could be made more readible:
Table t =
new Table();
.setName("Meta");
.addColumn( new Column()
c.setName("type")
c.setType(TypeMap.VARCHAR)
c.setSize("2048")
c.setPrimaryKey(true)
)
.addColumn( new Column()
.setName("super")
.setType(TypeMap.VARCHAR)
.setSize("2048")
)
if Invocation Chaining is introduced, though I would prefer
Table t =
new Table
( "Meta"
, new Column("type", TypeMap.VARCHAR, 2048, true)
, new Column("super", TypeMap.VARCHAR, 2048)
)
using point 1 above with varargs: Table(String name, Column... columns)
What do you think about these?
Rijk J.C. van Haaften