Class StringToDateConverter

  • All Implemented Interfaces:
    Converter<String,​Date>, org.springframework.beans.factory.InitializingBean

    public class StringToDateConverter
    extends Object
    implements Converter<String,​Date>, org.springframework.beans.factory.InitializingBean
    Converts String to Date, with a custom pattern and time zone.
    Author:
    avasquez
    • Field Detail

      • datePattern

        protected String datePattern
      • dateFormat

        protected org.apache.commons.lang3.time.FastDateFormat dateFormat
    • Constructor Detail

      • StringToDateConverter

        public StringToDateConverter()
    • Method Detail

      • setDatePattern

        public void setDatePattern​(String datePattern)
      • setTimeZone

        public void setTimeZone​(String timeZone)
      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      • convert

        public Date convert​(String source)
        Description copied from interface: Converter
        Converts the source object from S type to T type.
        Specified by:
        convert in interface Converter<String,​Date>
        Parameters:
        source - the object to convert
        Returns:
        the converted object