de.ispsoft.jaxme.util
Class Format

java.lang.Object
  extended byde.ispsoft.jaxme.util.Format

public class Format
extends java.lang.Object

A set of utility methods for working with java.text.Format objects.

Version:
$Id: Format.java,v 1.4 2002/12/17 20:59:09 joe Exp $
Author:
Jochen Wiedmann

Constructor Summary
Format()
           
 
Method Summary
static java.lang.String formatDate(java.text.DateFormat pFormat, java.util.Date pDate)
          Takes an instance of java.util.Date and converts it to a String using the given instance of DateFormat.
static java.lang.Object parseByAbstractFormat(java.lang.String pValue, java.text.Format pFormat)
          Invokes the given formatters parseObject() method and returns the value.
static java.util.Date parseByDateFormat(java.lang.String pValue, java.text.DateFormat pFormat)
          Parses the given String using the given DateFormat.
static java.lang.Number parseByNumberFormat(java.lang.String pValue, java.text.NumberFormat pFormat)
          Parses the given String using the given NumberFormat.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Format

public Format()
Method Detail

parseByDateFormat

public static java.util.Date parseByDateFormat(java.lang.String pValue,
                                               java.text.DateFormat pFormat)
                                        throws org.xml.sax.SAXException

Parses the given String using the given DateFormat. A possible ParseException is catched and thrown by encapsulating it within a SAXException.

Throws:
org.xml.sax.SAXException

parseByNumberFormat

public static java.lang.Number parseByNumberFormat(java.lang.String pValue,
                                                   java.text.NumberFormat pFormat)
                                            throws org.xml.sax.SAXException

Parses the given String using the given NumberFormat. A possible ParseException is catched and thrown by encapsulating it within a SAXException.

Throws:
org.xml.sax.SAXException

parseByAbstractFormat

public static java.lang.Object parseByAbstractFormat(java.lang.String pValue,
                                                     java.text.Format pFormat)
                                              throws org.xml.sax.SAXException

Invokes the given formatters parseObject() method and returns the value. A possible ParseException is converted into a SAXException and rethrown.

Throws:
org.xml.sax.SAXException

formatDate

public static java.lang.String formatDate(java.text.DateFormat pFormat,
                                          java.util.Date pDate)

Takes an instance of java.util.Date and converts it to a String using the given instance of DateFormat. Synchronizes on the DateFormat instance, in order to avoid problems in a multithreaded environment.