Klasse DateTimeFormatterService
java.lang.Object
org.apache.turbine.services.BaseInitable
org.apache.turbine.services.BaseService
org.apache.turbine.services.TurbineBaseService
org.apache.turbine.services.localization.DateTimeFormatterService
- Alle implementierten Schnittstellen:
Initable,DateTimeFormatterInterface,Service
public class DateTimeFormatterService
extends TurbineBaseService
implements DateTimeFormatterInterface
This service is used to format
TemporalAccessor and
map(String, DateTimeFormatter, Locale) (different flavors)
objects into strings.
The methods may throw UnsupportedTemporalTypeException or
DateTimeParseException, e.g.
if the source and the target format do not match appropriately.-
Feldübersicht
Von Klasse geerbte Felder org.apache.turbine.services.BaseService
configuration, name, serviceBrokerVon Klasse geerbte Felder org.apache.turbine.services.BaseInitable
initableBroker, isInitializedVon Schnittstelle geerbte Felder org.apache.turbine.services.localization.DateTimeFormatterInterface
DATE_TIME_FORMAT_DEFAULT, DATE_TIME_FORMAT_KEY, DATE_TIME_ZONEID_KEY, USE_REQUEST_LOCALE_KEY, USE_TURBINE_LOCALE_KEYVon Schnittstelle geerbte Felder org.apache.turbine.services.Service
SERVICE_NAME -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibung<T extends TemporalAccessor>
Stringformat(T temporalAccessor) Formats the given datetime as a String with the #getDefaultFormat().<T extends TemporalAccessor>
StringFormats the given date as a String.<T extends TemporalAccessor>
StringFormats the given date as a String.<T extends TemporalAccessor>
StringFormats the given date as a String.voidinit()Initialize the service.Maps from an incoming format to an outgoing formatDateTimeFormatter.map(String src, DateTimeFormatter outgoingFormat, Locale locale) Uses as incomingDateTimeFormatterDateTimeFormatterInterface.getDefaultFormat().map(String src, DateTimeFormatter outgoingFormat, Locale locale, DateTimeFormatter incomingFormat) Uses as incoming formatDateTimeFormatterInterface.getDefaultFormat()and no locale.mapFrom(String src, DateTimeFormatter incomingFormat) mapTo(String src, DateTimeFormatter outgoingFormat) Uses as outgoingDateTimeFormatterDateTimeFormatterInterface.getDefaultFormat()and no locale.voidvoidVon Klasse geerbte Methoden org.apache.turbine.services.TurbineBaseService
init, init, shutdownVon Klasse geerbte Methoden org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBrokerVon Klasse geerbte Methoden org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBrokerVon Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitVon Schnittstelle geerbte Methoden org.apache.turbine.services.Initable
getInit, setInitableBroker
-
Konstruktordetails
-
DateTimeFormatterService
public DateTimeFormatterService()
-
-
Methodendetails
-
getDefaultFormat
- Angegeben von:
getDefaultFormatin SchnittstelleDateTimeFormatterInterface
-
getFormatPattern
- Angegeben von:
getFormatPatternin SchnittstelleDateTimeFormatterInterface
-
init
Initialize the service. thedateTimeFormatfromformatPatternis initialized withLocale:LocaleUtils.getDefaultLocale()is used by default. It could be overridden setting #USE_TURBINE_LOCALE_KEY to false, the the default LocaleLocale.getDefault()is used.ZoneId: If #DATE_TIME_ZONEID_KEY is set thisZoneIdis used elseZoneId.systemDefault().
- Angegeben von:
initin SchnittstelleInitable- Setzt außer Kraft:
initin KlasseTurbineBaseService
-
format
Beschreibung aus Schnittstelle kopiert:DateTimeFormatterInterfaceFormats the given datetime as a String with the #getDefaultFormat(). using the default date format.- Angegeben von:
formatin SchnittstelleDateTimeFormatterInterface- Parameter:
temporalAccessor-Ungültige Eingabe: "to format"- Gibt zurück:
- String value of the date
-
format
Beschreibung aus Schnittstelle kopiert:DateTimeFormatterInterfaceFormats the given date as a String.- Angegeben von:
formatin SchnittstelleDateTimeFormatterInterface- Parameter:
temporalAccessor- TimeDate date to formatdateFormatString- format string to use. SeeDateTimeFormatterfor details.- Gibt zurück:
- String value of the date
-
format
public <T extends TemporalAccessor> String format(T temporalAccessor, String dateFormatString, Locale locale) Beschreibung aus Schnittstelle kopiert:DateTimeFormatterInterfaceFormats the given date as a String.- Angegeben von:
formatin SchnittstelleDateTimeFormatterInterface- Parameter:
temporalAccessor- TimeDate date to formatdateFormatString- format string to use. SeeDateTimeFormatterfor details.locale- used to loclize the format- Gibt zurück:
- String value of the date
-
format
public <T extends TemporalAccessor> String format(T temporalAccessor, String dateFormatString, Locale locale, ZoneId zoneId) Beschreibung aus Schnittstelle kopiert:DateTimeFormatterInterfaceFormats the given date as a String.- Angegeben von:
formatin SchnittstelleDateTimeFormatterInterface- Parameter:
temporalAccessor- TimeDate date to formatdateFormatString- format string to use. SeeDateTimeFormatterfor details.locale- theLocalezoneId- theZoneId- Gibt zurück:
- String value of the date
-
map
public String map(String src, String outgoingFormatPattern, Locale locale, String incomingFormatPattern) Beschreibung aus Schnittstelle kopiert:DateTimeFormatterInterfaceMaps from an incoming format to an outgoing formatDateTimeFormatter.- Angegeben von:
mapin SchnittstelleDateTimeFormatterInterface- Parameter:
src- the formatted datetimeoutgoingFormatPattern- the outgoingFormat pattern,DateTimeFormatterlocale- Locale, if needed for outgoing formatting, no default.incomingFormatPattern- the incming format patternDateTimeFormatter, optional, default isDateTimeFormatterInterface.getDefaultFormat().- Gibt zurück:
- the newly mapped
-
map
public String map(String src, DateTimeFormatter outgoingFormat, Locale locale, DateTimeFormatter incomingFormat) Beschreibung aus Schnittstelle kopiert:DateTimeFormatterInterfaceUses as incoming formatDateTimeFormatterInterface.getDefaultFormat()and no locale.- Angegeben von:
mapin SchnittstelleDateTimeFormatterInterface- Parameter:
src- the text, which will be parsed using the incomingFormat.outgoingFormat- the outgoing formatter, which will format.locale- The locale, if not null which will outgoingFormat use,DateTimeFormatter.withLocale(Locale).incomingFormat- the incoming formatter, which will be parsed.- Gibt zurück:
- the formatted string
-
mapTo
Beschreibung aus Schnittstelle kopiert:DateTimeFormatterInterfaceUses as outgoingDateTimeFormatterDateTimeFormatterInterface.getDefaultFormat()and no locale.- Angegeben von:
mapToin SchnittstelleDateTimeFormatterInterface- Parameter:
src- the datetime formatted stringoutgoingFormat- the format of this string- Gibt zurück:
- the date time formatted
-
mapFrom
- Angegeben von:
mapFromin SchnittstelleDateTimeFormatterInterface- Parameter:
src- the datetime formatted stringincomingFormat- the format to which this incoming string should be formatted.- Gibt zurück:
- the newly formatted date time string
-
map
Beschreibung aus Schnittstelle kopiert:DateTimeFormatterInterfaceUses as incomingDateTimeFormatterDateTimeFormatterInterface.getDefaultFormat().- Angegeben von:
mapin SchnittstelleDateTimeFormatterInterface- Parameter:
src- the datetime formatted stringoutgoingFormat- the format to which this string should be formatted.locale- The locale, if not null,the incomingFormat will use.- Gibt zurück:
- the newly formatted date time string
-
getLocale
-
setLocale
-
getZoneId
- Angegeben von:
getZoneIdin SchnittstelleDateTimeFormatterInterface
-
setZoneId
-