Class DateTypeConverter

  • All Implemented Interfaces:
    TypeConverter<java.lang.String,​java.util.Date>

    public class DateTypeConverter
    extends java.lang.Object
    implements TypeConverter<java.lang.String,​java.util.Date>
    java.util.Date type converter. Converts a String date (by default in the "yyyy-MM-dd" format) to a Date type. Does not accept null or empty strings.
    Author:
    Mahmoud Ben Hassine ([email protected])
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_DATE_FORMAT
      The default date format.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Date convert​(java.lang.String value)
      Convert a source type into a target type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_DATE_FORMAT

        public static final java.lang.String DEFAULT_DATE_FORMAT
        The default date format.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DateTypeConverter

        public DateTypeConverter()
        Create a Date converter with the default format DEFAULT_DATE_FORMAT
      • DateTypeConverter

        public DateTypeConverter​(java.lang.String dateFormat)
        Create a Date converter with the specified date format.
        Parameters:
        dateFormat - the date format to use
    • Method Detail

      • convert

        public java.util.Date convert​(java.lang.String value)
        Convert a source type into a target type.
        Specified by:
        convert in interface TypeConverter<java.lang.String,​java.util.Date>
        Parameters:
        value - the input value to convert
        Returns:
        The converted value