org.clazzes.jdbc2xml.schema
Class ColumnInfo

java.lang.Object
  extended by org.clazzes.jdbc2xml.schema.ColumnInfo

public class ColumnInfo
extends Object

This class holds metadata of a database column.

Author:
wglas

Constructor Summary
ColumnInfo(Attributes atts)
           
ColumnInfo(ResultSetMetaData md, int column)
          Set the column information from a column of a result set.
ColumnInfo(String name, int type, Integer precision, Integer scale, boolean nullable, String defaultValue)
           
ColumnInfo(String name, int type, Integer precision, Integer scale, boolean nullable, String defaultValue, boolean autoIncrement)
           
 
Method Summary
 String getDefaultValue()
           
 String getName()
           
 Integer getPrecision()
           
 Integer getScale()
           
 int getType()
           
 boolean isAutoIncrement()
           
 boolean isNullable()
           
 void setAutoIncrement(boolean autoIncrement)
           
 void setDefaultValue(String defaultValue)
           
 void setName(String name)
           
 void setNullable(boolean nullable)
           
 void setPrecision(Integer precision)
           
 void setScale(Integer scale)
           
 void setType(int type)
           
 Attributes toAttributes(SqlIdentifierMapper mapper)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnInfo

public ColumnInfo(String name,
                  int type,
                  Integer precision,
                  Integer scale,
                  boolean nullable,
                  String defaultValue,
                  boolean autoIncrement)
Parameters:
name - The column name.
type - The Type of the column.
precision - The field with or precision of the column.
scale - The number of fractional digits.
nullable - Whether this column allows null values.
defaultValue - The default column value.
autoIncrement - Whether this column is AUTO_INCREMENT

ColumnInfo

public ColumnInfo(String name,
                  int type,
                  Integer precision,
                  Integer scale,
                  boolean nullable,
                  String defaultValue)
Parameters:
name - The column name.
type - The Type of the column.
precision - The field with or precision of the column.
scale - The number of fractional digits.
nullable - Whether this column allows null values.
defaultValue - The default column value.

ColumnInfo

public ColumnInfo(Attributes atts)
           throws SAXException
Parameters:
atts - A bag of XML attributes.
Throws:
SAXException - If the attributes do not contain a name attribute.

ColumnInfo

public ColumnInfo(ResultSetMetaData md,
                  int column)
           throws SQLException
Set the column information from a column of a result set.

Parameters:
md - Result set metadata information received trough ResultSet.getMetaData().
column - The column number of the result set to inspect.
Throws:
SQLException - Upon Database errors.
Method Detail

toAttributes

public Attributes toAttributes(SqlIdentifierMapper mapper)
Returns:
A SAX Attributes bag filled with the information about this column.

getDefaultValue

public String getDefaultValue()
Returns:
the defaultValue

setDefaultValue

public void setDefaultValue(String defaultValue)
Parameters:
defaultValue - the defaultValue to set

setName

public void setName(String name)
Parameters:
name - the name to set

setType

public void setType(int type)
Parameters:
type - the type to set

setPrecision

public void setPrecision(Integer precision)
Parameters:
precision - the precision to set

setScale

public void setScale(Integer scale)
Parameters:
scale - the scale to set

setNullable

public void setNullable(boolean nullable)
Parameters:
nullable - the nullable to set

setAutoIncrement

public void setAutoIncrement(boolean autoIncrement)
Parameters:
autoIncrement - the autoIncrement to set

getName

public String getName()
Returns:
the name

getType

public int getType()
Returns:
The SQL type.
See Also:
Types

getPrecision

public Integer getPrecision()
Returns:
The optional field precision.

getScale

public Integer getScale()
Returns:
The optional field scale (the precision after the comma).

isNullable

public boolean isNullable()
Returns:
Whether the column is nullable.

isAutoIncrement

public boolean isAutoIncrement()
Returns:
the autoIncrement


Copyright © 2011. All Rights Reserved.