Package net.sf.jguiraffe.transform
Klasse DateTimeTransformer
java.lang.Object
net.sf.jguiraffe.transform.DateTransformerBase
net.sf.jguiraffe.transform.DateTimeTransformer
- Alle implementierten Schnittstellen:
Transformer
,Validator
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
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected static final String
Constant for the time style property.Von Klasse geerbte Felder net.sf.jguiraffe.transform.DateTransformerBase
PROP_AFTER, PROP_BEFORE, PROP_EQUAL, PROP_LENIENT, PROP_REFERENCE_DATE, PROP_STYLE
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected DateFormat
createFormat
(Locale locale, int style, org.apache.commons.configuration.Configuration config) Creates the format object to be used by this transformer.int
Returns the style for the time portion.void
setTimeStyle
(int timeStyle) Sets the style for the time.Von Klasse geerbte Methoden net.sf.jguiraffe.transform.DateTransformerBase
errorResult, getDefaultReferenceDate, getReferenceDate, getReferenceDateProperty, getStyle, initializeFormat, isAfter, isBefore, isDateValid, isEqual, isLenient, isValid, setAfter, setBefore, setEqual, setLenient, setReferenceDate, setStyle, transform, transformDate, transformSqlDate, transformToDate, transformToString, updateDatePart, updateTimePart
-
Felddetails
-
PROP_TIME_STYLE
Constant for the time style property.- Siehe auch:
-
-
Konstruktordetails
-
DateTimeTransformer
public DateTimeTransformer()Creates a new instance ofDateTimeTransformer
.
-
-
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 byjava.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 ofDateFormat
.- Angegeben von:
createFormat
in KlasseDateTransformerBase
- Parameter:
locale
- the localestyle
- the style for the date portionconfig
- the configuration with the properties- Gibt zurück:
- the format object
-