Module org.tquadrat.foundation.util
Class OffsetTimeStringConverter
java.lang.Object
org.tquadrat.foundation.util.stringconverter.TimeDateStringConverter<OffsetTime>
org.tquadrat.foundation.util.stringconverter.OffsetTimeStringConverter
- All Implemented Interfaces:
Serializable,StringConverter<OffsetTime>
@ClassVersion(sourceVersion="$Id: OffsetTimeStringConverter.java 1130 2024-05-05 16:16:09Z tquadrat $")
@API(status=STABLE,
since="0.4.5")
public class OffsetTimeStringConverter
extends TimeDateStringConverter<OffsetTime>
The implementation of
TimeDateStringConverter
for java.time.OffsetTime.- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: OffsetTimeStringConverter.java 1130 2024-05-05 16:16:09Z tquadrat $
- Since:
- 0.4.5
- See Also:
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.util.stringconverter.OffsetTimeStringConverter"
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final OffsetTimeStringConverterAn instance of this class.Fields inherited from class org.tquadrat.foundation.util.stringconverter.TimeDateStringConverter
MSG_InvalidDateTimeFormatFields inherited from interface org.tquadrat.foundation.lang.StringConverter
METHOD_NAME_GetSubjectClass, METHOD_NAME_Provider -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newOffsetTimeStringConverterinstance that usesDateTimeFormatter.ISO_OFFSET_TIMEto format/parse the date.OffsetTimeStringConverter(DateTimeFormatter formatter) Creates a newOffsetTimeStringConverterinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected final OffsetTimeparseDateTime(CharSequence source, Optional<DateTimeFormatter> formatter) Parses the given String to an instance ofTemporal.static final OffsetTimeStringConverterprovider()This method is used by theServiceLoaderto obtain the instance for thisStringConverterimplementation.Methods inherited from class org.tquadrat.foundation.util.stringconverter.TimeDateStringConverter
fromString, getSubjectClass, toString
-
Field Details
-
INSTANCE
An instance of this class.
-
-
Constructor Details
-
OffsetTimeStringConverter
public OffsetTimeStringConverter()Creates a newOffsetTimeStringConverterinstance that usesDateTimeFormatter.ISO_OFFSET_TIMEto format/parse the date. -
OffsetTimeStringConverter
Creates a newOffsetTimeStringConverterinstance.- Note:
-
- The formatter may not drop any part of the offset time, otherwise
fromString()may fail. This means that the formatter is only allowed to re-order the temporal fields.
- The formatter may not drop any part of the offset time, otherwise
- Parameters:
formatter- The formatter for the temporal accessor.
-
-
Method Details
-
parseDateTime
protected final OffsetTime parseDateTime(CharSequence source, Optional<DateTimeFormatter> formatter) throws DateTimeParseException Parses the given String to an instance ofTemporal. The caller ensures thatsourceis notnull, not the empty String and does not contain only whitespace.- Specified by:
parseDateTimein classTimeDateStringConverter<OffsetTime>- Parameters:
source- The String to parse.formatter- The formatter for parsing the String- Returns:
- The time/date value.
- Throws:
DateTimeParseException- The given value cannot be parsed to aTemporal.
-
provider
This method is used by theServiceLoaderto obtain the instance for thisStringConverterimplementation.- Returns:
- The instance for this
StringConverterimplementation.
-
