ca.sqlpower.wabit.report.chart
Enum ChartColumn.DataType

java.lang.Object
  extended by java.lang.Enum<ChartColumn.DataType>
      extended by ca.sqlpower.wabit.report.chart.ChartColumn.DataType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ChartColumn.DataType>
Enclosing class:
ChartColumn

public static enum ChartColumn.DataType
extends java.lang.Enum<ChartColumn.DataType>

Enumeration of the data types a chart column can have.

Names are chosen for compatibility with DataType, with which this enum will eventually be merged.


Enum Constant Summary
DATE
           
NUMERIC
           
TEXT
           
 
Method Summary
static ChartColumn.DataType forJDBCType(int jdbcType)
          Returns the appropriate data type based on the given JDBC type.
static ChartColumn.DataType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ChartColumn.DataType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

TEXT

public static final ChartColumn.DataType TEXT

NUMERIC

public static final ChartColumn.DataType NUMERIC

DATE

public static final ChartColumn.DataType DATE
Method Detail

values

public static ChartColumn.DataType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ChartColumn.DataType c : ChartColumn.DataType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ChartColumn.DataType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

forJDBCType

public static ChartColumn.DataType forJDBCType(int jdbcType)
Returns the appropriate data type based on the given JDBC type. If the type is non-standard or not recognized, it will be assumed to be a string.

FIXME because of variability of database platforms, it would be far better if we had the help of the DataSourceType object for the platform the type code came from. It could be passed in as a parameter to this method.

XXX we do this in enough places in all our products (and in fact elsewhere in Wabit that it would make sense to create a common SimplifiedSQLType enum in ca.sqlpower.sql and use it everywhere. Such a type would be written to get the help of the DataSourceType in question.

Parameters:
jdbcType - the type code from java.sql.Types.
Returns:
the data type that most closely represents the given type code.


Copyright © 2009. All Rights Reserved.