net.sf.ofx4j.io
Class DefaultStringConversion

java.lang.Object
  extended by net.sf.ofx4j.io.DefaultStringConversion
All Implemented Interfaces:
StringConversion

public class DefaultStringConversion
extends java.lang.Object
implements StringConversion

Utility class for conversion to/from OFX strings.

Author:
Ryan Heaton

Field Summary
static int DATE_FORMAT_LENGTH
           
static java.util.TimeZone GMT_TIME_ZONE
           
static int TIME_FORMAT_LENGTH
           
 
Constructor Summary
DefaultStringConversion()
           
 
Method Summary
protected  java.lang.String formatDate(java.util.Date date)
          Format the date according to the OFX spec.
protected  java.lang.String formatTime(java.sql.Time time)
          Format the time according to the OFX spec.
<E> E
fromString(java.lang.Class<E> clazz, java.lang.String value)
          Convert the specified value to an object of the specified type.
protected  java.util.Date parseDate(java.lang.String value)
          Parses a date according to OFX.
protected  java.sql.Time parseTime(java.lang.String value)
          Parses a time according to OFX.
protected  java.util.TimeZone parseTimeZone(java.lang.String tzoffset)
          Parse the timezone offset of the form [HOURS_OFF_GMT:TZ_ID]
 java.lang.String toString(java.lang.Object value)
          Convert the specified object to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GMT_TIME_ZONE

public static final java.util.TimeZone GMT_TIME_ZONE

DATE_FORMAT_LENGTH

public static final int DATE_FORMAT_LENGTH

TIME_FORMAT_LENGTH

public static final int TIME_FORMAT_LENGTH
Constructor Detail

DefaultStringConversion

public DefaultStringConversion()
Method Detail

toString

public java.lang.String toString(java.lang.Object value)
Description copied from interface: StringConversion
Convert the specified object to a string.

Specified by:
toString in interface StringConversion
Parameters:
value - The value to convert to a string.
Returns:
The string.

fromString

public <E> E fromString(java.lang.Class<E> clazz,
                        java.lang.String value)
             throws OFXSyntaxException
Description copied from interface: StringConversion
Convert the specified value to an object of the specified type.

Specified by:
fromString in interface StringConversion
Parameters:
clazz - The class.
value - The value.
Returns:
The converted value.
Throws:
OFXSyntaxException - If there was something wrong with the syntax of the string.

parseDate

protected java.util.Date parseDate(java.lang.String value)
Parses a date according to OFX.

Parameters:
value - The value of the date.
Returns:
The date value.

formatDate

protected java.lang.String formatDate(java.util.Date date)
Format the date according to the OFX spec.

Parameters:
date - The date.
Returns:
The date format.

parseTime

protected java.sql.Time parseTime(java.lang.String value)
Parses a time according to OFX.

Parameters:
value - The value of the date.
Returns:
The date value.

formatTime

protected java.lang.String formatTime(java.sql.Time time)
Format the time according to the OFX spec.

Parameters:
time - The time to format.
Returns:
The formatted time.

parseTimeZone

protected java.util.TimeZone parseTimeZone(java.lang.String tzoffset)
Parse the timezone offset of the form [HOURS_OFF_GMT:TZ_ID]

Parameters:
tzoffset - The offset pattern.
Returns:
The timezone.


Copyright © 2008. All Rights Reserved.