Klasse DateTimeTransformer

java.lang.Object
net.sf.jguiraffe.transform.DateTransformerBase
net.sf.jguiraffe.transform.DateTimeTransformer
Alle implementierten Schnittstellen:
Transformer, Validator

public class DateTimeTransformer extends DateTransformerBase

A specialized transformer that transforms strings into date objects with both a date and time component.

This transformer class allows user to enter a date and a time in a single input field, such as 1/31/2008 10:19. Most of the required functionality is already implemented by the base class. This class creates an appropriate DateFormat object that supports parsing time stamps.

For the documentation of the supported error messages refer to the super class. In addition to the properties defined by DateTransformerBase, the following properties can be set:

Property Description Default
timeStyle Defines the style of the time component. This can be one of the style constants declared by the java.text.DateFormat class like SHORT or FULL. While the style for the date component is set by the inherited style property, with this property the style for the time component can be set separately. SHORT

Version:
$Id: DateTimeTransformer.java 205 2012-01-29 18:29:57Z oheger $
Autor:
Oliver Heger
  • Felddetails

    • PROP_TIME_STYLE

      protected static final String PROP_TIME_STYLE
      Constant for the time style property.
      Siehe auch:
  • Konstruktordetails

    • DateTimeTransformer

      public DateTimeTransformer()
      Creates a new instance of DateTimeTransformer.
  • Methodendetails

    • getTimeStyle

      public int getTimeStyle()
      Returns the style for the time portion.
      Gibt zurück:
      the style for the time
    • setTimeStyle

      public void setTimeStyle(int timeStyle)
      Sets the style for the time. The styles for the date portion and the time portion are separately set. Here one of the constants supported by java.text.DateFormat (e.g. SHORT, MEDIUM etc.) can be passed in.
      Parameter:
      timeStyle - the style for the time
    • createFormat

      protected DateFormat createFormat(Locale locale, int style, org.apache.commons.configuration.Configuration config)
      Creates the format object to be used by this transformer. This implementation returns a date/time instance of DateFormat.
      Angegeben von:
      createFormat in Klasse DateTransformerBase
      Parameter:
      locale - the locale
      style - the style for the date portion
      config - the configuration with the properties
      Gibt zurück:
      the format object