com.jrefinery.report.filter
Class SimpleDateFormatFilter

java.lang.Object
  extended bycom.jrefinery.report.filter.FormatFilter
      extended bycom.jrefinery.report.filter.DateFormatFilter
          extended bycom.jrefinery.report.filter.SimpleDateFormatFilter
All Implemented Interfaces:
java.lang.Cloneable, DataFilter, DataSource, DataTarget, java.io.Serializable

public class SimpleDateFormatFilter
extends DateFormatFilter

A filter that creates string from dates. This filter will format java.util. Date objects using a java.text.SimpleDateFormat to create the string representation for the date obtained from the datasource.

If the object read from the datasource is no date, the NullValue defined by setNullValue(Object) is returned.

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

Author:
Thomas Morgner
See Also:
SimpleDateFormat, Serialized Form

Constructor Summary
SimpleDateFormatFilter()
          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 filter.
 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 filter.
 
Methods inherited from class com.jrefinery.report.filter.DateFormatFilter
getDateFormat, setDateFormat
 
Methods inherited from class com.jrefinery.report.filter.FormatFilter
clone, getDataSource, getFormatter, getNullValue, getValue, setDataSource, setNullValue
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDateFormatFilter

public SimpleDateFormatFilter()
DefaultConstructor.

Method Detail

getSimpleDateFormat

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

Returns:
The date format object.

setSimpleDateFormat

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

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 DateFormatFilter
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 format string for the used 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