I am increasingly dissatisfied with ColumnDefinition's existence. As a step towards its phasing out, make it a mutable datadump for Depot's nefarious benefit.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2500 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
par.winzell
2008-12-09 23:08:57 +00:00
parent d6c62dde74
commit 4b82d4dee1
2 changed files with 15 additions and 39 deletions
@@ -274,8 +274,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
*/
public String expandDefinition (ColumnDefinition def)
{
return expandDefinition(
def.getType(), def.isNullable(), def.isUnique(), def.getDefaultValue());
return expandDefinition(def.type, def.nullable, def.unique, def.defaultValue);
}
protected int executeQuery (Connection conn, String query)
@@ -25,6 +25,16 @@ package com.samskivert.jdbc;
*/
public class ColumnDefinition
{
public String type;
public boolean nullable;
public boolean unique;
public String defaultValue;
public ColumnDefinition ()
{
this(null);
}
public ColumnDefinition (String type)
{
this(type, false, false, null);
@@ -33,42 +43,9 @@ public class ColumnDefinition
public ColumnDefinition (
String type, boolean nullable, boolean unique, String defaultValue)
{
if (type == null) {
throw new IllegalArgumentException("cannot build column definition without type");
}
_type = type;
_nullable = nullable;
_unique = unique;
_defaultValue = defaultValue;
this.type = type;
this.nullable = nullable;
this.unique = unique;
this.defaultValue = defaultValue;
}
/** Returns the SQL type of this column, e.g. INTEGER. */
public String getType ()
{
return _type;
}
/** Determines whether or not this column should allow NULL values. */
public boolean isNullable ()
{
return _nullable;
}
/** Determines whether or not this column should reject duplicate values. */
public boolean isUnique ()
{
return _unique;
}
/** Returns the value to insert into this column instead of nulls, if any. */
public String getDefaultValue ()
{
return _defaultValue;
}
protected String _type;
protected boolean _nullable;
protected boolean _unique;
protected String _defaultValue;
}