From 4b82d4dee1a106cbf036b09d59f8ae13a7722092 Mon Sep 17 00:00:00 2001 From: "par.winzell" Date: Tue, 9 Dec 2008 23:08:57 +0000 Subject: [PATCH] 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 --- src/java/com/samskivert/jdbc/BaseLiaison.java | 3 +- .../com/samskivert/jdbc/ColumnDefinition.java | 51 +++++-------------- 2 files changed, 15 insertions(+), 39 deletions(-) diff --git a/src/java/com/samskivert/jdbc/BaseLiaison.java b/src/java/com/samskivert/jdbc/BaseLiaison.java index ed356fcb..c59c3c5d 100644 --- a/src/java/com/samskivert/jdbc/BaseLiaison.java +++ b/src/java/com/samskivert/jdbc/BaseLiaison.java @@ -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) diff --git a/src/java/com/samskivert/jdbc/ColumnDefinition.java b/src/java/com/samskivert/jdbc/ColumnDefinition.java index 2bde1c1d..6fcf1529 100644 --- a/src/java/com/samskivert/jdbc/ColumnDefinition.java +++ b/src/java/com/samskivert/jdbc/ColumnDefinition.java @@ -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; }