Class StringToSqlDateConverter

  • All Implemented Interfaces:
    Converter<java.lang.String,​java.sql.Date>

    public class StringToSqlDateConverter
    extends ConverterAdapter<java.lang.String,​java.sql.Date>
    Converts instances of String to Date. This class is thread-safe.
    Author:
    Eric Nielsen
    • Constructor Detail

      • StringToSqlDateConverter

        public StringToSqlDateConverter​(java.lang.String pattern)
        Parameters:
        pattern - pattern to use for conversion
      • StringToSqlDateConverter

        public StringToSqlDateConverter​(java.text.DateFormat format)
        Parameters:
        format - DateFormat to use for conversion
    • Method Detail

      • sourceClass

        protected java.lang.Class<java.lang.String> sourceClass()
        Specified by:
        sourceClass in class ConverterAdapter<java.lang.String,​java.sql.Date>
      • destinationClass

        protected java.lang.Class<java.sql.Date> destinationClass()
        Specified by:
        destinationClass in class ConverterAdapter<java.lang.String,​java.sql.Date>
      • doConvert

        public java.sql.Date doConvert​(java.lang.String source)
                                throws java.text.ParseException
        Description copied from class: ConverterAdapter
        Converts instance of S to T.
        Specified by:
        doConvert in class ConverterAdapter<java.lang.String,​java.sql.Date>
        Parameters:
        source - instance of String or null
        Returns:
        source converted to java.sql.Date, or null if source is blank
        Throws:
        java.text.ParseException - if conversion failed