org.eobjects.metamodel.util
Class FormatHelper

java.lang.Object
  extended by org.eobjects.metamodel.util.FormatHelper

public final class FormatHelper
extends Object

Helper class for formatting


Constructor Summary
FormatHelper()
           
 
Method Summary
static String formatSqlBoolean(ColumnType columnType, boolean b)
           
static String formatSqlTime(ColumnType columnType, Date date)
          Formats a date according to a specific column type (DATE, TIME or TIMESTAMP)
static String formatSqlTime(ColumnType columnType, Date date, boolean typeCastDeclaration)
          Formats a date according to a specific column type (DATE, TIME or TIMESTAMP).
static String formatSqlTime(ColumnType columnType, Date date, boolean typeCastDeclaration, String beforeDateLiteral, String afterDateLiteral)
          Formats a date according to a specific column type (DATE, TIME or TIMESTAMP)
static String formatSqlValue(ColumnType columnType, Object value)
           
static NumberFormat getSqlNumberFormat()
           
static NumberFormat getUiNumberFormat()
          Creates a uniform number format which is similar to that of eg.
static Date parseSqlTime(ColumnType columnType, String value)
          Parses a SQL string representation of a time based value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormatHelper

public FormatHelper()
Method Detail

getUiNumberFormat

public static NumberFormat getUiNumberFormat()
Creates a uniform number format which is similar to that of eg. Java doubles. The format will not include thousand separators and it will use a dot as a decimal separator.

Returns:

getSqlNumberFormat

public static NumberFormat getSqlNumberFormat()

formatSqlBoolean

public static String formatSqlBoolean(ColumnType columnType,
                                      boolean b)

formatSqlTime

public static String formatSqlTime(ColumnType columnType,
                                   Date date)
Formats a date according to a specific column type (DATE, TIME or TIMESTAMP)

Parameters:
columnType - the column type
date - the date value
Returns:

formatSqlTime

public static String formatSqlTime(ColumnType columnType,
                                   Date date,
                                   boolean typeCastDeclaration,
                                   String beforeDateLiteral,
                                   String afterDateLiteral)
Formats a date according to a specific column type (DATE, TIME or TIMESTAMP)

Parameters:
columnType - the column type
date - the date value
typeCastDeclaration - whether or not to include a type cast declaration
beforeDateLiteral - before date literal
afterDateLiteral - after date literal
Returns:

formatSqlTime

public static String formatSqlTime(ColumnType columnType,
                                   Date date,
                                   boolean typeCastDeclaration)
Formats a date according to a specific column type (DATE, TIME or TIMESTAMP). For backward compatibility.

Parameters:
columnType -
date -
typeCastDeclaration -
Returns:

parseSqlTime

public static Date parseSqlTime(ColumnType columnType,
                                String value)
Parses a SQL string representation of a time based value

Parameters:
type -
value -
Returns:

formatSqlValue

public static String formatSqlValue(ColumnType columnType,
                                    Object value)


Copyright © 2007-2013. All Rights Reserved.