public class

ClarizenDateConverter

extends AbstractConverter
java.lang.Object
   ↳ org.apache.commons.beanutils.converters.AbstractConverter
     ↳ org.mule.modules.clarizen.api.ClarizenDateConverter

Summary

[Expand]
Inherited Constants
From class org.apache.commons.beanutils.converters.AbstractConverter
Fields
private String displayPatterns
private Locale locale
private String[] patterns
private TimeZone timeZone
private boolean useLocaleFormat
[Expand]
Inherited Fields
From class org.apache.commons.beanutils.converters.AbstractConverter
Public Constructors
ClarizenDateConverter()
ClarizenDateConverter(Object defaultValue)
Public Methods
String classToString(Class type)
Provide a String representation of a java.lang.Class.
String getDisplayPatterns()
Locale getLocale()
String[] getPatterns()
Return the date format patterns used to convert dates to/from a java.lang.String (or null if none specified).
TimeZone getTimeZone()
boolean isUseLocaleFormat()
void setDisplayPatterns(String displayPatterns)
void setLocale(Locale locale)
void setPattern(String pattern)
Set a date format pattern to use to convert dates to/from a java.lang.String.
void setPatterns(String[] patterns)
Set the date format patterns to use to convert dates to/from a java.lang.String.
void setTimeZone(TimeZone timeZone)
void setUseLocaleFormat(boolean useLocaleFormat)
String toString()
Provide a String representation of this date/time converter.
Protected Methods
String convertToString(Object value)
Object convertToType(Class targetType, Object value)
Convert the input object into a Date object of the specified type.
Class<?> getDefaultType()
DateFormat getFormat(Locale locale, TimeZone timeZone)
Return a DateFormat for the Locale.
[Expand]
Inherited Methods
From class org.apache.commons.beanutils.converters.AbstractConverter
From class java.lang.Object
From interface org.apache.commons.beanutils.Converter

Fields

private String displayPatterns

private Locale locale

private String[] patterns

private TimeZone timeZone

private boolean useLocaleFormat

Public Constructors

public ClarizenDateConverter ()

public ClarizenDateConverter (Object defaultValue)

Parameters
defaultValue

Public Methods

public String classToString (Class type)

Provide a String representation of a java.lang.Class.

Parameters
type The java.lang.Class.
Returns
  • The String representation.

public String getDisplayPatterns ()

public Locale getLocale ()

public String[] getPatterns ()

Return the date format patterns used to convert dates to/from a java.lang.String (or null if none specified).

Returns
  • Array of format patterns.
See Also
  • SimpleDateFormat

public TimeZone getTimeZone ()

public boolean isUseLocaleFormat ()

public void setDisplayPatterns (String displayPatterns)

Parameters
displayPatterns

public void setLocale (Locale locale)

Parameters
locale

public void setPattern (String pattern)

Set a date format pattern to use to convert dates to/from a java.lang.String.

Parameters
pattern The format pattern.
See Also
  • SimpleDateFormat

public void setPatterns (String[] patterns)

Set the date format patterns to use to convert dates to/from a java.lang.String.

Parameters
patterns Array of format patterns.
See Also
  • SimpleDateFormat

public void setTimeZone (TimeZone timeZone)

Parameters
timeZone

public void setUseLocaleFormat (boolean useLocaleFormat)

Parameters
useLocaleFormat

public String toString ()

Provide a String representation of this date/time converter.

Returns
  • A String representation of this date/time converter

Protected Methods

protected String convertToString (Object value)

Parameters
value
Throws
Throwable

protected Object convertToType (Class targetType, Object value)

Convert the input object into a Date object of the specified type.

This method handles conversions between the following types:

  • javax.xml.datatype.XMLGregorianCalendar
  • java.util.Date
  • java.util.Calendar
  • java.sql.Date
  • java.sql.Time
  • java.sql.Timestamp
It also handles conversion from a String to any of the above types.

For String conversion, if the converter has been configured with one or more patterns (using setPatterns()), then the conversion is attempted with each of the specified patterns. Otherwise the default DateFormat for the default locale (and style if configured) will be used.

Parameters
targetType Data type to which this value should be converted.
value The input value to be converted.
Returns
  • The converted value.
Throws
Exception if conversion cannot be performed successfully

protected Class<?> getDefaultType ()

protected DateFormat getFormat (Locale locale, TimeZone timeZone)

Return a DateFormat for the Locale.

Parameters
locale The Locale to create the Format with (may be null)
timeZone The Time Zone create the Format with (may be null)
Returns
  • A Date Format.