|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.sqlpower.architect.SQLObject
ca.sqlpower.architect.SQLColumn
public class SQLColumn
| Nested Class Summary | |
|---|---|
static class |
SQLColumn.ColumnNameComparator
A comparator for SQLColumns that only pays attention to the column names. |
static class |
SQLColumn.CompareByPKSeq
This comparator helps you sort a list of columns so that the primary key columns come first in their correct order, and all the other columns come after. |
| Field Summary | |
|---|---|
protected boolean |
autoIncrement
This property indicates that values stored in this column should default to some automatcially-incrementing sequence of values. |
protected java.lang.String |
defaultValue
|
protected int |
nullable
This column's nullability type. |
protected SQLObject |
parent
|
protected int |
precision
The maximum length of the field in digits or characters. |
protected java.lang.Integer |
primaryKeySeq
This property is the sort key for this column in primary key index. |
protected int |
referenceCount
referenceCount is meant to keep track of how many containers (i.e. |
protected java.lang.String |
remarks
|
protected int |
scale
The maximum number of digits after the decimal point. |
protected SQLColumn |
sourceColumn
Refers back to the real database-connected SQLColumn that this column was originally derived from. |
protected int |
type
Must be a type defined in java.sql.Types. |
| Fields inherited from class ca.sqlpower.architect.SQLObject |
|---|
children, magicDisableCount, populated, undoEventListeners |
| Constructor Summary | |
|---|---|
SQLColumn()
|
|
SQLColumn(SQLColumn col)
Creates a reasonable facsimile of the given column. |
|
SQLColumn(SQLTable parent,
java.lang.String colName,
int type,
int precision,
int scale)
|
|
SQLColumn(SQLTable parentTable,
java.lang.String colName,
int dataType,
java.lang.String nativeType,
int precision,
int scale,
int nullable,
java.lang.String remarks,
java.lang.String defaultValue,
java.lang.Integer primaryKeySeq,
boolean isAutoIncrement)
Constructs a SQLColumn that will be a part of the given SQLTable. |
|
| Method Summary | |
|---|---|
void |
addReference()
|
boolean |
allowsChildren()
Returns true if and only if this object can have child SQLObjects. |
java.lang.String |
getAutoIncrementSequenceName()
Returns the auto-increment sequence name, or a made-up default ( parentTableName_columnName_seq) if the sequence name
has not been set explicitly. |
java.lang.Class<? extends SQLObject> |
getChildType()
|
java.lang.String |
getDefaultValue()
Gets the value of defaultValue |
static SQLColumn |
getDerivedInstance(SQLColumn source,
SQLTable addTo)
Makes a near clone of the given source column. |
int |
getNullable()
|
SQLObject |
getParent()
Returns the parent of this SQLObject or null if it
is a root object such as SQLDatabase. |
SQLTable |
getParentTable()
Returns the parent SQLTable object, which is actually a grandparent. |
int |
getPrecision()
Gets the value of precision |
java.lang.Integer |
getPrimaryKeySeq()
Gets the value of primaryKeySeq |
int |
getReferenceCount()
|
java.lang.String |
getRemarks()
Gets the value of remarks |
int |
getScale()
Gets the value of scale |
java.lang.String |
getShortDisplayName()
Returns a short string that should be displayed to the user for representing this SQLObject as a label. |
SQLColumn |
getSourceColumn()
|
java.lang.String |
getSourceDataTypeName()
|
int |
getType()
Gets the value of type |
boolean |
isAutoIncrement()
Gets the value of autoIncrement |
boolean |
isAutoIncrementSequenceNameSet()
Returns true if the auto-increment sequence name of this column has been changed from its default value. |
boolean |
isDefinitelyNullable()
Figures out this column's nullability |
boolean |
isExported()
Indicates whether or not this column is exported into a foreign key in a child table. |
boolean |
isForeignKey()
Indicates whether this column is a foreign key |
boolean |
isIndexed()
Returns whether this column is in an index |
boolean |
isPopulated()
Tells if this object has already been filled with children, or if that operation is still pending. |
boolean |
isPrimaryKey()
Is primaryKeySeq defined |
boolean |
isUniqueIndexed()
Returns whether this column is in an unique index. |
void |
populate()
Causes this SQLObject to load its children (if any exist). |
void |
removeReference()
|
void |
setAutoIncrement(boolean argAutoIncrement)
Sets the value of autoIncrement |
void |
setAutoIncrementSequenceName(java.lang.String autoIncrementSequenceName)
Only sets the name if it is different from the default name. |
void |
setDefaultValue(java.lang.String argDefaultValue)
Sets the value of defaultValue |
void |
setNullable(int argNullable)
Sets the value of nullable |
protected void |
setParent(SQLObject argParent)
Sets the value of parent |
void |
setPrecision(int argPrecision)
Sets the value of precision |
void |
setPrimaryKeySeq(java.lang.Integer argPrimaryKeySeq)
Sets the value of primaryKeySeq, and moves the column to the appropriate location in the parent table's column folder. |
void |
setReferenceCount(int referenceCount)
Deprecated. This method exists only to be called reflectively by the undo manager. You should use addReference() and removeReference(). |
void |
setRemarks(java.lang.String argRemarks)
Sets the value of remarks |
void |
setScale(int argScale)
Sets the value of scale |
void |
setSourceColumn(SQLColumn col)
|
void |
setSourceDataTypeName(java.lang.String n)
|
void |
setType(int argType)
Sets the value of type |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected SQLColumn sourceColumn
protected SQLObject parent
protected int type
protected int precision
protected int scale
protected int nullable
protected java.lang.String remarks
protected java.lang.String defaultValue
protected java.lang.Integer primaryKeySeq
protected boolean autoIncrement
protected int referenceCount
| Constructor Detail |
|---|
public SQLColumn()
public SQLColumn(SQLTable parentTable,
java.lang.String colName,
int dataType,
java.lang.String nativeType,
int precision,
int scale,
int nullable,
java.lang.String remarks,
java.lang.String defaultValue,
java.lang.Integer primaryKeySeq,
boolean isAutoIncrement)
parentTable - The table that this column will think it belongs to.colName - This column's name.dataType - The number that represents this column's type. See java.sql.Types.nativeType - The type as it is called in the source database.scale - The length of this column. Size is type-dependant.precision - The number of places of precision after the decimal place for numeric types.nullable - This column's nullability. One of:
remarks - User-defined remarks about this columndefaultValue - The value this column will have if another value is not specified.primaryKeySeq - This column's position in the table's primary key. Null if it is not in the PK.isAutoIncrement - Does this column auto-increment?
public SQLColumn(SQLTable parent,
java.lang.String colName,
int type,
int precision,
int scale)
public SQLColumn(SQLColumn col)
| Method Detail |
|---|
public static SQLColumn getDerivedInstance(SQLColumn source,
SQLTable addTo)
public java.lang.String toString()
toString in class java.lang.Object
public void populate()
throws ArchitectException
SQLObject
populate in class SQLObjectArchitectExceptionpublic boolean isPopulated()
SQLObject
isPopulated in class SQLObjectpublic java.lang.String getShortDisplayName()
SQLObject
getShortDisplayName in class SQLObjectpublic boolean allowsChildren()
SQLObjectreturn true" or
"return false" depending on object type.
allowsChildren in class SQLObjectpublic SQLObject getParent()
SQLObjectnull if it
is a root object such as SQLDatabase.
getParent in class SQLObjectpublic SQLColumn getSourceColumn()
public void setSourceColumn(SQLColumn col)
public int getType()
public void setType(int argType)
argType - Value to assign to this.typepublic java.lang.String getSourceDataTypeName()
public void setSourceDataTypeName(java.lang.String n)
public int getScale()
public void setScale(int argScale)
argScale - Value to assign to this.scalepublic int getPrecision()
public void setPrecision(int argPrecision)
argPrecision - Value to assign to this.precisionpublic boolean isDefinitelyNullable()
public boolean isPrimaryKey()
public boolean isForeignKey()
public boolean isExported()
public boolean isIndexed()
public boolean isUniqueIndexed()
public SQLTable getParentTable()
protected void setParent(SQLObject argParent)
setParent in class SQLObjectargParent - Value to assign to this.parentpublic int getNullable()
public void setNullable(int argNullable)
argNullable - Value to assign to this.nullablepublic java.lang.String getRemarks()
public void setRemarks(java.lang.String argRemarks)
argRemarks - Value to assign to this.remarkspublic java.lang.String getDefaultValue()
public void setDefaultValue(java.lang.String argDefaultValue)
argDefaultValue - Value to assign to this.defaultValuepublic java.lang.Integer getPrimaryKeySeq()
public void setPrimaryKeySeq(java.lang.Integer argPrimaryKeySeq)
public boolean isAutoIncrement()
public void setAutoIncrement(boolean argAutoIncrement)
argAutoIncrement - Value to assign to this.autoIncrementpublic java.lang.String getAutoIncrementSequenceName()
parentTableName_columnName_seq) if the sequence name
has not been set explicitly. The auto-increment sequence
name is a hint to DDL generators for platforms that need
sequence objects to support auto-incrementing column values.
public void setAutoIncrementSequenceName(java.lang.String autoIncrementSequenceName)
public boolean isAutoIncrementSequenceNameSet()
public void addReference()
public void removeReference()
public int getReferenceCount()
@Deprecated public void setReferenceCount(int referenceCount)
referenceCount - public java.lang.Class<? extends SQLObject> getChildType()
getChildType in class SQLObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||