ca.sqlpower.architect.ddl
Class GenericTypeDescriptor

java.lang.Object
  extended by ca.sqlpower.architect.ddl.GenericTypeDescriptor

public class GenericTypeDescriptor
extends java.lang.Object

GenericTypeDescriptor is a class that describes a SQL type. It can be populated from DatabaseMetaData.getTypeInfo results, or you can make up your own types.


Field Summary
protected  int dataType
           
protected  boolean hasPrecision
           
protected  boolean hasScale
           
protected  java.lang.String literalPrefix
           
protected  java.lang.String literalSuffix
           
protected  java.lang.String name
           
protected  int nullable
           
protected  long precision
           
 
Constructor Summary
GenericTypeDescriptor(java.sql.ResultSet rs)
          Creates a new GenericTypeDescriptor with properties filled in from the current row of rs, which should have been obtained from DatabaseMetaData.getTypeInfo().
GenericTypeDescriptor(java.lang.String name, int dataType, long precision, java.lang.String literalPrefix, java.lang.String literalSuffix, int nullable, boolean hasPrecision, boolean hasScale)
           
 
Method Summary
 void determineScaleAndPrecision()
          This method sets the hasScale and hasPrecision properties based on the current setting of dataType.
 int getDataType()
          Gets the value of dataType
 boolean getHasPrecision()
          Gets the value of hasPrecision
 boolean getHasScale()
          Gets the value of hasScale
 java.lang.String getLiteralPrefix()
          Gets the value of literalPrefix
 java.lang.String getLiteralSuffix()
          Gets the value of literalSuffix
 java.lang.String getName()
          Gets the value of name
 int getNullable()
          Gets the value of nullable
 long getPrecision()
          Gets the value of precision
 boolean isNullable()
           
 void setDataType(int argDataType)
          Sets the value of dataType
 void setHasPrecision(boolean argHasPrecision)
          Sets the value of hasPrecision
 void setHasScale(boolean argHasScale)
          Sets the value of hasScale
 void setLiteralPrefix(java.lang.String argLiteralPrefix)
          Sets the value of literalPrefix
 void setLiteralSuffix(java.lang.String argLiteralSuffix)
          Sets the value of literalSuffix
 void setName(java.lang.String argName)
          Sets the value of name
 void setNullable(int argNullable)
          Sets the value of nullable
 void setPrecision(long argPrecision)
          Sets the value of precision
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

dataType

protected int dataType

precision

protected long precision

literalPrefix

protected java.lang.String literalPrefix

literalSuffix

protected java.lang.String literalSuffix

nullable

protected int nullable

hasPrecision

protected boolean hasPrecision

hasScale

protected boolean hasScale
Constructor Detail

GenericTypeDescriptor

public GenericTypeDescriptor(java.sql.ResultSet rs)
                      throws java.sql.SQLException
Creates a new GenericTypeDescriptor with properties filled in from the current row of rs, which should have been obtained from DatabaseMetaData.getTypeInfo().

Throws:
java.sql.SQLException

GenericTypeDescriptor

public GenericTypeDescriptor(java.lang.String name,
                             int dataType,
                             long precision,
                             java.lang.String literalPrefix,
                             java.lang.String literalSuffix,
                             int nullable,
                             boolean hasPrecision,
                             boolean hasScale)
Method Detail

determineScaleAndPrecision

public void determineScaleAndPrecision()
This method sets the hasScale and hasPrecision properties based on the current setting of dataType. Subclasses for specific database platforms should override this method if any types for that database are determined incorrectly by this generic method.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Gets the value of name

Returns:
the value of name

setName

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

Parameters:
argName - Value to assign to this.name

getDataType

public int getDataType()
Gets the value of dataType

Returns:
the value of dataType

setDataType

public void setDataType(int argDataType)
Sets the value of dataType

Parameters:
argDataType - Value to assign to this.dataType

getPrecision

public long getPrecision()
Gets the value of precision

Returns:
the value of precision

setPrecision

public void setPrecision(long argPrecision)
Sets the value of precision

Parameters:
argPrecision - Value to assign to this.precision

getLiteralPrefix

public java.lang.String getLiteralPrefix()
Gets the value of literalPrefix

Returns:
the value of literalPrefix

setLiteralPrefix

public void setLiteralPrefix(java.lang.String argLiteralPrefix)
Sets the value of literalPrefix

Parameters:
argLiteralPrefix - Value to assign to this.literalPrefix

getLiteralSuffix

public java.lang.String getLiteralSuffix()
Gets the value of literalSuffix

Returns:
the value of literalSuffix

setLiteralSuffix

public void setLiteralSuffix(java.lang.String argLiteralSuffix)
Sets the value of literalSuffix

Parameters:
argLiteralSuffix - Value to assign to this.literalSuffix

getNullable

public int getNullable()
Gets the value of nullable

Returns:
the value of nullable

setNullable

public void setNullable(int argNullable)
Sets the value of nullable

Parameters:
argNullable - Value to assign to this.nullable

isNullable

public boolean isNullable()

getHasScale

public boolean getHasScale()
Gets the value of hasScale

Returns:
the value of hasScale

setHasScale

public void setHasScale(boolean argHasScale)
Sets the value of hasScale

Parameters:
argHasScale - Value to assign to this.hasScale

getHasPrecision

public boolean getHasPrecision()
Gets the value of hasPrecision

Returns:
the value of hasPrecision

setHasPrecision

public void setHasPrecision(boolean argHasPrecision)
Sets the value of hasPrecision

Parameters:
argHasPrecision - Value to assign to this.hasPrecision


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca