public class TimeTransformer extends DateTransformerBase
A specialized transformer that transforms strings into date objects, taking only the time portion into account.
Most of the required functionality is already implemented by the base class.
This class only creates an appropriate DateFormat object that
supports parsing time values.
For the documentation of the supported properties refer to the super class.
The error messaged produced by this class are analogous to the ones used by
DateTransformerBase, but specific for time objects. So an
application can display different error messages for invalid date and time
inputs. The following table lists the possible error messages:
| Message key | Description | Parameters |
|---|---|---|
|
The passed in string cannot be parsed to a time object. | {0} = the time string |
|
The entered time must be after the reference date. | {0} = the (formatted) reference date |
|
The entered time must be after or equal the reference date. | {0} = the (formatted) reference date |
|
The entered time must be before the reference date. | {0} = the (formatted) reference date |
|
The entered time must be before or equal the reference date. | {0} = the (formatted) reference date |
ValidationMessageConstantsPROP_AFTER, PROP_BEFORE, PROP_EQUAL, PROP_LENIENT, PROP_REFERENCE_DATE, PROP_STYLE| Constructor and Description |
|---|
TimeTransformer() |
| Modifier and Type | Method and Description |
|---|---|
protected DateFormat |
createFormat(Locale locale,
int style,
org.apache.commons.configuration.Configuration config)
Returns a format object for formatting and parsing time objects.
|
protected ValidationResult |
errorResult(String errorKey,
TransformerContext ctx,
Object... params)
Returns a validation result object with an error message.
|
getDefaultReferenceDate, getReferenceDate, getReferenceDateProperty, getStyle, initializeFormat, isAfter, isBefore, isDateValid, isEqual, isLenient, isValid, setAfter, setBefore, setEqual, setLenient, setReferenceDate, setStyle, transform, transformDate, transformSqlDate, transformToDate, transformToString, updateDatePart, updateTimePartprotected DateFormat createFormat(Locale locale, int style, org.apache.commons.configuration.Configuration config)
createFormat in class DateTransformerBaselocale - the localestyle - the style to be usedconfig - the configuration with the current propertiesprotected ValidationResult errorResult(String errorKey, TransformerContext ctx, Object... params)
errorResult in class DateTransformerBaseerrorKey - the key of the error messagectx - the transformer contextparams - additional parametersCopyright © 2016 The JGUIraffe Team. All rights reserved.