net.sourceforge.jdbcimporter
Class ColumnDef

java.lang.Object
  extended bynet.sourceforge.jdbcimporter.ColumnDef
Direct Known Subclasses:
ExportColumnDef, GenerateColumnDef, ImportColumnDef

public class ColumnDef
extends java.lang.Object

The ColumnDef class defines a column in an entity.

Version:
0.6
Author:
Chris Nagy

Field Summary
static java.lang.String DATE_FORMAT
          The date format.
static java.lang.String DECIMAL_FORMAT
          The decimal format.
static java.lang.String FULL_NUMBER_FORMAT
          The integer/long format.
static java.lang.String TIME_FORMAT
          The time format.
static java.lang.String TIMESTAMP_FORMAT
          The timestamp format.
static int UNKNOWN_SQL_TYPE
          Constant that indicates that the column's SQL Type is unknown.
 
Constructor Summary
ColumnDef()
           
 
Method Summary
 void addProperty(java.lang.String key, java.lang.String value)
          Add a property that is associated with the column def.
protected  int convertStringToSQLType(java.lang.String sqlString)
          Converts the name (case-insensitive) of a static variable defined in java.sql.Types into the value of the static variable.
protected  void createFormat()
          Create the format based on the SQL type and the pattern.
 java.lang.String getDefaultValue()
          Returns the default value of the column.
 java.text.Format getFormat()
          Returns the format used when parsing the data in the file.
 java.lang.String getFormatPattern()
          Returns the format pattern used when parsing the data in the file.
 java.lang.String getName()
          Returns the name of the column
 java.lang.String getProperty(java.lang.String key)
          Returns the value of a property that is associated with the column def.
 int getType()
          Returns the sql type of the column
 void setDefaultValue(java.lang.String newDefaultValue)
          Sets the default value of the column.
 void setFormatPattern(java.lang.String pattern)
          Sets the format pattern used when parsing the data in the file.
 void setName(java.lang.String newName)
          Sets the name of the column.
 void setSQLType(java.lang.String newType)
          Sets the sql type of the column.
 void setType(int newType)
          Sets the sql type of the column
 java.lang.String toString()
          Overrides Object.toString()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_SQL_TYPE

public static final int UNKNOWN_SQL_TYPE
Constant that indicates that the column's SQL Type is unknown.

Since:
0.64
See Also:
Constant Field Values

DATE_FORMAT

public static final java.lang.String DATE_FORMAT
The date format.

See Also:
Constant Field Values

TIME_FORMAT

public static final java.lang.String TIME_FORMAT
The time format.

See Also:
Constant Field Values

TIMESTAMP_FORMAT

public static final java.lang.String TIMESTAMP_FORMAT
The timestamp format.

See Also:
Constant Field Values

FULL_NUMBER_FORMAT

public static final java.lang.String FULL_NUMBER_FORMAT
The integer/long format.

See Also:
Constant Field Values

DECIMAL_FORMAT

public static final java.lang.String DECIMAL_FORMAT
The decimal format.

See Also:
Constant Field Values
Constructor Detail

ColumnDef

public ColumnDef()
Method Detail

setName

public void setName(java.lang.String newName)
Sets the name of the column.

Parameters:
newName - name of the column

getName

public java.lang.String getName()
Returns the name of the column

Returns:
name of the column

setSQLType

public void setSQLType(java.lang.String newType)
Sets the sql type of the column.

Parameters:
newType - name (case-insensitive) of the sql type that equals the name of a static variable defined in java.sql.Types

getType

public int getType()
Returns the sql type of the column

Returns:
the value of a static variable defined in java.sql.Types

setType

public void setType(int newType)
Sets the sql type of the column

Parameters:
newType - value of a static variable defined in java.sql.Types

setDefaultValue

public void setDefaultValue(java.lang.String newDefaultValue)
Sets the default value of the column. The default value of the column is applied when a row's column value is null or an empty String.

Parameters:
newDefaultValue - default value for this column

getDefaultValue

public java.lang.String getDefaultValue()
Returns the default value of the column.

Returns:
default value for this column

setFormatPattern

public void setFormatPattern(java.lang.String pattern)
Sets the format pattern used when parsing the data in the file. The pattern syntax is taken from java.text.SimpleDataFormat for date, time, and timestamp column types.

Parameters:
pattern - the format pattern

getFormatPattern

public java.lang.String getFormatPattern()
Returns the format pattern used when parsing the data in the file.

Returns:
the format pattern

getFormat

public java.text.Format getFormat()
Returns the format used when parsing the data in the file.

Returns:
the format

addProperty

public void addProperty(java.lang.String key,
                        java.lang.String value)
Add a property that is associated with the column def.

Parameters:
key - the name of the property
value - the value of the property

getProperty

public java.lang.String getProperty(java.lang.String key)
Returns the value of a property that is associated with the column def. If the property does not exist then null is returned.

Parameters:
key - the name of the property
Returns:
the value of the property

convertStringToSQLType

protected int convertStringToSQLType(java.lang.String sqlString)
Converts the name (case-insensitive) of a static variable defined in java.sql.Types into the value of the static variable. If no static variable is found with the given name then -1 is returned.

Parameters:
sqlString - name of a static variable defined in java.sql.Types

createFormat

protected void createFormat()
Create the format based on the SQL type and the pattern.


toString

public java.lang.String toString()
Overrides Object.toString()