Class TemporalConverterFactory

  • All Implemented Interfaces:
    ConverterFactory

    public class TemporalConverterFactory
    extends Object
    implements ConverterFactory
    Converter factory which created converting between the various temporal types.

    Supported save conversions:

    • Date to Calendar
    • Time to Calendar
    • Date to Timestamp
    • Date to Date
    • Calendar to Date
    • Calendar to Timestamp
    • XMLGregorianCalendar to Calendar
    • Calendar to XMLGregorianCalendar
    • XMLGregorianCalendar to Date
    • Date to XMLGregorianCalendar
    • String to TimeZone
    • Instant to Date

    Supported unsafe (lossy) conversions:

    • Date to Time
    • Calendar to Time
    • Timestamp to Calendar

    The hint ConverterFactory.SAFE_CONVERSION is used to control which conversions will be applied.

    The hint #DATE_FORMAT can be used to control the format of converting a temporal value to a String.

    Since:
    2.4
    Author:
    Justin Deoliveira, The Open Planning Project
    • Constructor Detail

      • TemporalConverterFactory

        public TemporalConverterFactory()
    • Method Detail

      • createConverter

        public Converter createConverter​(Class source,
                                         Class target,
                                         Hints hints)
        Description copied from interface: ConverterFactory
        Creates a Converter instance for converting one type of object to another.
        Specified by:
        createConverter in interface ConverterFactory
        Parameters:
        source - The type to convert from.
        target - The type to convert to.
        hints - Hints used to be used while creating a converter.
        Returns:
        The converter, or null if one could not be found.