org.glite.rgma
Class ColumnDefinition

java.lang.Object
  extended byorg.glite.rgma.ColumnDefinition
All Implemented Interfaces:
java.lang.Cloneable

public class ColumnDefinition
extends java.lang.Object
implements java.lang.Cloneable

Definition of a column in an SQL CREATE TABLE statement.


Constructor Summary
ColumnDefinition()
          Constructs an empty ColumnDefinition object.
ColumnDefinition(java.lang.String columnName, java.lang.String type, int size, boolean isNotNull, boolean isPrimaryKey)
          Constructs a ColumnDefinition object.
 
Method Summary
 java.lang.Object clone()
          Gets a clone of this object.
 boolean containsValidSize()
          Determines if the column has a size.
 boolean equals(java.lang.Object obj)
          Compares this object with the specified object.
 java.lang.String getName()
          Returns the name of the column.
 int getSize()
          Returns the size of the column.
 java.lang.String getType()
          Returns the type of the column.
 java.lang.String getTypeString()
          Gets a String representation of the column type (including size, NOT NULL and PRIMARY KEY).
 int hashCode()
          Returns a hash code value for the object.
 boolean isNotNull()
          Returns the NOT NULL flag.
 boolean isPrimaryKey()
          Returns the PRIMARY KEY flag.
 void setName(java.lang.String name)
          Sets the name of the column.
 void setNotNull(boolean notNull)
          Sets the NOT NULL flag.
 void setPrimaryKey(boolean primaryKey)
          Sets the PRIMARY KEY flag.
 void setType(java.lang.String type)
          Sets the type of the column.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnDefinition

public ColumnDefinition()
Constructs an empty ColumnDefinition object.


ColumnDefinition

public ColumnDefinition(java.lang.String columnName,
                        java.lang.String type,
                        int size,
                        boolean isNotNull,
                        boolean isPrimaryKey)
Constructs a ColumnDefinition object.

Parameters:
columnName - Name of column.
type - Type of column as a String.
size - Size of type (e.g. width of VARCHAR). 0 if not applicable.
isNotNull - NOT NULL flag.
isPrimaryKey - PRIMARY KEY flag.
See Also:
Types
Method Detail

setName

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

Parameters:
name - The name to set.

getName

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

Returns:
The name of the column.

setNotNull

public void setNotNull(boolean notNull)
Sets the NOT NULL flag.

Parameters:
notNull - The value to set.

isNotNull

public boolean isNotNull()
Returns the NOT NULL flag.

Returns:
The value of the NOT NULL flag.

setPrimaryKey

public void setPrimaryKey(boolean primaryKey)
Sets the PRIMARY KEY flag.

Parameters:
primaryKey - The value to set.

isPrimaryKey

public boolean isPrimaryKey()
Returns the PRIMARY KEY flag.

Returns:
The value of the PRIMARY KEY flag.

setType

public void setType(java.lang.String type)
Sets the type of the column.

Parameters:
type - The type to set

getType

public java.lang.String getType()
Returns the type of the column.

Returns:
The type of the column.

getSize

public int getSize()
Returns the size of the column.

Returns:
The size of the column (or 0 if none is specified).

containsValidSize

public boolean containsValidSize()
Determines if the column has a size.

Returns:
True if the column type has an associated size > 0.

equals

public boolean equals(java.lang.Object obj)
Compares this object with the specified object.

Parameters:
obj - Object to compare.
Returns:
true if this object and the specified object are equal.
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Returns a hash code value for the object.

Returns:
A hash code value for this object.
See Also:
Object.hashCode()

getTypeString

public java.lang.String getTypeString()
Gets a String representation of the column type (including size, NOT NULL and PRIMARY KEY).

Returns:
A String representation of the column type.

toString

public java.lang.String toString()
Returns a string representation of the object.

Returns:
A string representation of the object.
See Also:
Object.toString()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Gets a clone of this object.

Returns:
A clone of this object.
Throws:
java.lang.CloneNotSupportedException - If this object does not support cloning.