Class TemporalConverter.Conversion<T extends Temporal,​R>

  • Type Parameters:
    T - the concrete type of the temporal object this conversion function accepts.
    R - the concrete type of the converted value.
    Enclosing class:
    TemporalConverter

    public static class TemporalConverter.Conversion<T extends Temporal,​R>
    extends Object
    A conversion function of a temporal object into a value of type R.
    • Method Detail

      • of

        public static <T extends Temporal,​R> TemporalConverter.Conversion<T,​R> of​(Class<T> type,
                                                                                              Function<T,​R> converter)
        Constructs a conversion function that will apply to the specified concrete type of Temporal objects and that will return a value of the specified concrete type R.
        Type Parameters:
        T - the accepted Temporal concrete type.
        R - the type to which the temporal objects will be converted.
        Parameters:
        type - the expected concrete type of the Temporal objects to convert.
        converter - the temporal conversion implementation.
        Returns:
        a TemporalConverter.Conversion instance.
      • accepts

        public boolean accepts​(Temporal temporal)
        Does this conversion function accepts to the type of the specified temporal object.
        Parameters:
        temporal - a Temporal object.
        Returns:
        true if this function known how to convert the concrete type of the given Temporal object to a value of type R. False otherwise.
      • apply

        public R apply​(Temporal temporal)
        Applies the conversion to the specified Temporal object.
        Parameters:
        temporal - a Temporal object. Must be of type T otherwise a ClassCastException is thrown.
        Returns:
        a value of type R, issued from the conversion of the Temporal object.
      • getAcceptedType

        public String getAcceptedType()
        Gets the simple name of the concrete type of Temporal objects this conversion function accepts as argument.
        Returns:
        the simple name of the Temporal class accepted by this conversion function.