com.isti.util.gui.textvalidator
Class SQLTextUtils

java.lang.Object
  extended by com.isti.util.gui.textvalidator.SQLTextUtils

public class SQLTextUtils
extends java.lang.Object

Class SQLTextUtils defines utility methods to for SQL text.


Nested Class Summary
static class SQLTextUtils.TimestampText
          Time stamp text.
 
Field Summary
static long DEFAULT_EPOCH_TIME_VALUE
          The default epoch time value.
static java.sql.Time DEFAULT_TIME_VALUE
          The default time value.
 
Constructor Summary
SQLTextUtils()
           
 
Method Summary
static java.sql.Date getDateValue(java.lang.String s)
          Gets the date.
static java.sql.Date getDateValue(java.lang.String s, long defaultEpochTime)
          Gets the date.
static java.sql.Timestamp getTimestampValue(java.lang.String s)
          Gets the timestamp value for the specified date and time.
static java.sql.Timestamp getTimestampValue(java.lang.String s, long defaultEpochTime)
          Gets the timestamp for the specified date and time.
static java.sql.Timestamp getTimestampValue(java.lang.String dateText, java.lang.String timeText)
          Gets the timestamp value for the specified date and time.
static java.sql.Timestamp getTimestampValue(java.lang.String dateText, java.lang.String timeText, long defaultEpochTime)
          Gets the timestamp value for the specified date and time.
static java.sql.Time getTimeValue(java.lang.String s)
          Gets the time.
static java.sql.Time getTimeValue(java.lang.String s, java.sql.Time defaultTime)
          Gets the time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_EPOCH_TIME_VALUE

public static long DEFAULT_EPOCH_TIME_VALUE
The default epoch time value.

See Also:
getDateValue(String)

DEFAULT_TIME_VALUE

public static java.sql.Time DEFAULT_TIME_VALUE
The default time value.

See Also:
getTimeValue(String)
Constructor Detail

SQLTextUtils

public SQLTextUtils()
Method Detail

getDateValue

public static java.sql.Date getDateValue(java.lang.String s)
Gets the date.

Parameters:
s - a String object representing a date in in the format "yyyy-mm-dd".
Returns:
the date.
Throws:
java.lang.IllegalArgumentException - if the date given is not in the JDBC date escape format (yyyy-mm-dd).

getDateValue

public static java.sql.Date getDateValue(java.lang.String s,
                                         long defaultEpochTime)
Gets the date.

Parameters:
s - a String object representing a date in in the format "yyyy-mm-dd".
defaultEpochTime - the epoch time to use if the date text is empty.
Returns:
the date.
Throws:
java.lang.IllegalArgumentException - if the date given is not in the JDBC date escape format (yyyy-mm-dd).

getTimestampValue

public static java.sql.Timestamp getTimestampValue(java.lang.String dateText,
                                                   java.lang.String timeText)
Gets the timestamp value for the specified date and time.

Parameters:
dateText - the date text.
timeText - the time text.
Returns:
the Timestamp value or null if error.

getTimestampValue

public static java.sql.Timestamp getTimestampValue(java.lang.String dateText,
                                                   java.lang.String timeText,
                                                   long defaultEpochTime)
Gets the timestamp value for the specified date and time.

Parameters:
dateText - the date text.
timeText - the time text.
defaultEpochTime - the epoch time to use if the date text is empty.
Returns:
the Timestamp value or null if error.

getTimestampValue

public static java.sql.Timestamp getTimestampValue(java.lang.String s)
Gets the timestamp value for the specified date and time.

Parameters:
s - the timestamp text.
Returns:
the Timestamp value or null if error.

getTimestampValue

public static java.sql.Timestamp getTimestampValue(java.lang.String s,
                                                   long defaultEpochTime)
Gets the timestamp for the specified date and time.

Parameters:
s - the timestamp text.
defaultEpochTime - the epoch time to use if the date text is empty.
Returns:
the Timestamp or null if error.

getTimeValue

public static java.sql.Time getTimeValue(java.lang.String s)
Gets the time.

Parameters:
s - a String object representing a time in in the format "hh:mm:ss".
Returns:
the time.
Throws:
java.lang.IllegalArgumentException - if the date given is not in the JDBC time escape format (hh:mm:ss).

getTimeValue

public static java.sql.Time getTimeValue(java.lang.String s,
                                         java.sql.Time defaultTime)
Gets the time.

Parameters:
s - a String object representing a time in in the format "hh:mm:ss".
defaultTime - the time to return if the time text is empty.
Returns:
the time.
Throws:
java.lang.IllegalArgumentException - if the date given is not in the JDBC time escape format (hh:mm:ss).