Package org.jeasy.batch.core.converter
Class DateTypeConverter
- java.lang.Object
-
- org.jeasy.batch.core.converter.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 aDatetype. Does not acceptnullor empty strings.- Author:
- Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_DATE_FORMATThe default date format.
-
Constructor Summary
Constructors Constructor Description DateTypeConverter()Create a Date converter with the default formatDEFAULT_DATE_FORMATDateTypeConverter(java.lang.String dateFormat)Create a Date converter with the specified date format.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Dateconvert(java.lang.String value)Convert a source type into a target type.
-
-
-
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 formatDEFAULT_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:
convertin interfaceTypeConverter<java.lang.String,java.util.Date>- Parameters:
value- the input value to convert- Returns:
- The converted value
-
-