Interface Converter<S,​T>

Type Parameters:
S - source type in other library
T - target type in Time4J
All Known Implementing Classes:
JDBCAdapter, TemporalType, XMLAdapter

public interface Converter<S,​T>

Serves as bridge to temporal types of JDK or other date and time libraries.

Note: All implementations must be immutable, ideally stateless.

Since:
3.24/4.20
Author:
Meno Hochschild
  • Method Summary

    Modifier and Type
    Method
    Description
    from​(T time4j)
    Converts the Time4J-type to an external type.
    Obtains the type of the source.
    translate​(S source)
    Converts the external type to a type in Time4J.
  • Method Details

    • translate

      T translate(S source)

      Converts the external type to a type in Time4J.

      Parameters:
      source - external object
      Returns:
      translated Time4J-object
      Throws:
      ArithmeticException - in case of numerical overflow
      ChronoException - if conversion fails
    • from

      S from(T time4j)

      Converts the Time4J-type to an external type.

      Parameters:
      time4j - Time4J-object
      Returns:
      translated object of external type
      Throws:
      ArithmeticException - in case of numerical overflow
      ChronoException - if conversion fails
    • getSourceType

      Class<S> getSourceType()

      Obtains the type of the source.

      Returns:
      Class
      Since:
      3.24/4.20