Class LocalDateTimeConverter
java.lang.Object
ch.admin.bag.covidcertificate.authorization.config.LocalDateTimeConverter
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<String,LocalDateTime>
@Component
@ConfigurationPropertiesBinding
public class LocalDateTimeConverter
extends Object
implements org.springframework.core.convert.converter.Converter<String,LocalDateTime>
Class to convert a ISO_LOCAL_DATE_TIME string to a LocalDateTime object.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionParses the given string named timestamp to a LocalDateTime object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.convert.converter.Converter
andThen
-
Constructor Details
-
LocalDateTimeConverter
public LocalDateTimeConverter()
-
-
Method Details
-
convert
Parses the given string named timestamp to a LocalDateTime object. It uses simply the parse method of the same.- Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<String,LocalDateTime> - Parameters:
timestamp- as string formatted as ISO_LOCAL_DATE_TIME- Returns:
- the LocalDateTime object or a runtime exception.
- Throws:
DateTimeParseException- if the given timestamp string is not formatted as ISO_LOCAL_DATE_TIMENullPointerException- if the given timestamp string is null
-