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 Details

    • LocalDateTimeConverter

      public LocalDateTimeConverter()
  • Method Details

    • convert

      public LocalDateTime convert(String timestamp)
      Parses the given string named timestamp to a LocalDateTime object. It uses simply the parse method of the same.
      Specified by:
      convert in interface org.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_TIME
      NullPointerException - if the given timestamp string is null