com.jrefinery.report.filter
Class SimpleDateFormatParser

java.lang.Object
  extended bycom.jrefinery.report.filter.FormatParser
      extended bycom.jrefinery.report.filter.DateFormatParser
          extended bycom.jrefinery.report.filter.SimpleDateFormatParser
All Implemented Interfaces:
java.lang.Cloneable, DataFilter, DataSource, DataTarget, java.io.Serializable

public class SimpleDateFormatParser
extends DateFormatParser

Parses a String into a java.util.Date. The string is read from the given datasource and then parsed by the dateformat contained in this FormatParser.

If the object read from the datasource is no string, the value is converted to string using String.valueOf (Object)

This implementation uses a SimpleDateFormat and grants more control over the parsing results.

Author:
Thomas Morgner
See Also:
SimpleDateFormat, Serialized Form

Constructor Summary
SimpleDateFormatParser()
          DefaultConstructor.
 
Method Summary
 java.lang.String getFormatString()
          Returns the formatString for this SimpleDateFormat.
 java.lang.String getLocalizedFormatString()
          Returns a localized formatString for this SimpleDateFormat.
 java.text.SimpleDateFormat getSimpleDateFormat()
          Returns the SimpleDateFormat object used in this parser.
 void setFormatString(java.lang.String format)
          defines the formatString for this SimpleDateFormat.
 void setFormatter(java.text.Format format)
          Sets the date format for the filter.
 void setLocalizedFormatString(java.lang.String format)
          defines the localized formatString for this SimpleDateFormat.
 void setSimpleDateFormat(java.text.SimpleDateFormat format)
          Sets the date format for the parser.
 
Methods inherited from class com.jrefinery.report.filter.DateFormatParser
getDateFormat, isValidOutput, setDateFormat, setNullValue
 
Methods inherited from class com.jrefinery.report.filter.FormatParser
clone, getDataSource, getFormatter, getNullValue, getValue, setDataSource
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDateFormatParser

public SimpleDateFormatParser()
DefaultConstructor.

Method Detail

getSimpleDateFormat

public java.text.SimpleDateFormat getSimpleDateFormat()
Returns the SimpleDateFormat object used in this parser.

Returns:
The date format object.

setSimpleDateFormat

public void setSimpleDateFormat(java.text.SimpleDateFormat format)
Sets the date format for the parser.

Parameters:
format - The format.
Throws:
java.lang.NullPointerException - if the format given is null

setFormatter

public void setFormatter(java.text.Format format)
Sets the date format for the filter. This narrows the allows formats down to SimpleDateFormat.

Overrides:
setFormatter in class DateFormatParser
Parameters:
format - The format.
Throws:
java.lang.NullPointerException - if the format given is null
java.lang.ClassCastException - if the format given is no DateFormat

getFormatString

public java.lang.String getFormatString()
Returns the formatString for this SimpleDateFormat. For a more detailed explaination of SimpleDateFormat formatstrings see java.text.SimpleDateFormat.

Returns:
the formatstring used for this DateFormat.
See Also:
SimpleDateFormat

setFormatString

public void setFormatString(java.lang.String format)
defines the formatString for this SimpleDateFormat.

Parameters:
format - the formatString
Throws:
java.lang.IllegalArgumentException - if the string is invalid

getLocalizedFormatString

public java.lang.String getLocalizedFormatString()
Returns a localized formatString for this SimpleDateFormat. For a more detailed explaination of SimpleDateFormat formatstrings see java.text.SimpleDateFormat.

Returns:
the localized format string.
See Also:
SimpleDateFormat

setLocalizedFormatString

public void setLocalizedFormatString(java.lang.String format)
defines the localized formatString for this SimpleDateFormat.

Parameters:
format - the formatString
Throws:
java.lang.IllegalArgumentException - if the string is invalid