Class TimeTranslator

java.lang.Object
com.powerupsoftwareengineering.java.immutable.web.model.translator.TimeTranslator

public final class TimeTranslator extends Object
The TimeTranslator class is a translator that will convert different time representations between the domain model and web model representations.
  • Field Details

    • DEFAULT_TIMEZONE

      public static final String DEFAULT_TIMEZONE
      The default timezone used if no timezone is provided.
      See Also:
  • Method Details

    • zonedDateTimeFromXml

      public static ZonedDateTime zonedDateTimeFromXml(XMLGregorianCalendar xmlGregorianCalendar)
      Translates from the xml date time definition to the Java Zoned Date Time representation.
      Parameters:
      xmlGregorianCalendar - XML Date Time representation to be translated.
      Returns:
      Java Zoned Date Time representation of the date time.
    • zonedDateTimeToXml

      public static XMLGregorianCalendar zonedDateTimeToXml(ZonedDateTime zonedDateTime)
      Translates from Java Date Time into XML Time representation.
      Parameters:
      zonedDateTime - Java Date Time to be translated.
      Returns:
      XML representation of Date Time.
    • localDateTimeFromXml

      public static LocalDateTime localDateTimeFromXml(XMLGregorianCalendar xmlGregorianCalendar)
      Translates from the xml date time definition to the Java Local Date Time representation.
      Parameters:
      xmlGregorianCalendar - XML Date Time representation to be translated.
      Returns:
      Java Local Date Time representation of the date time.
    • localDateTimeToXml

      public static XMLGregorianCalendar localDateTimeToXml(LocalDateTime localDateTime)
      Translates from Java Date Time into XML Time representation.
      Parameters:
      localDateTime - Java Date Time to be translated.
      Returns:
      XML representation of Date Time.
    • localDateFromXml

      public static LocalDate localDateFromXml(XMLGregorianCalendar xmlGregorianCalendar)
      Translates from the xml date time definition to the Java Local Date representation.
      Parameters:
      xmlGregorianCalendar - XML Date Time representation to be translated.
      Returns:
      Java Local Date representation of the date time.
    • localDateToXml

      public static XMLGregorianCalendar localDateToXml(LocalDate localDate)
      Translates from Time model object into XML Time representation.
      Parameters:
      localDate - Time to be translated.
      Returns:
      XML representation of Time.
    • localTimeFromXml

      public static LocalTime localTimeFromXml(XMLGregorianCalendar xmlGregorianCalendar)
      Translates from the xml date time definition to the Java Local time representation.
      Parameters:
      xmlGregorianCalendar - XML Date Time representation to be translated.
      Returns:
      Java Local time representation of the date time.
    • localTimeToXml

      public static XMLGregorianCalendar localTimeToXml(LocalTime localTime)
      Translates from Time model object into XML Time representation.
      Parameters:
      localTime - Time to be translated.
      Returns:
      XML representation of Time.
    • durationFromXml

      public static Duration durationFromXml(Duration jaxbDuration)
      Translates from the xml duration definition to the Java Duration representation.
      Parameters:
      jaxbDuration - XML Duration representation to be translated.
      Returns:
      Java Duration representation of the duration.
    • durationToXml

      public static Duration durationToXml(Duration duration)
      Translates from Java Duration model object into XML Duration representation.
      Parameters:
      duration - Duration to be translated.
      Returns:
      XML representation of Duration.
    • monthFromXml

      public static Month monthFromXml(String month)
      Translates from the xml month definition to the Java Month representation.
      Parameters:
      month - XML Month representation to be translated.
      Returns:
      Java Month representation of the month.
    • monthToXml

      public static String monthToXml(Month month)
      Translates from Java Month model object into XML Month representation.
      Parameters:
      month - Month to be translated.
      Returns:
      XML representation of Month.