@Test public void parseDateTest() { final SimpleDateFormat simpleDateFormat = new SimpleDateFormat( DomainParameterParser.DATE_FORMAT); final String dateString = "2015/03/27"; final Date date = DomainParameterParser.parseDate(dateString); assertThat(date).isNotNull(); assertThat(simpleDateFormat.format(date)).isEqualTo(dateString); }
public static Date parseDate(final String dateString) { Date date; try { date = new Date(Long.parseLong(dateString)); } catch (final Exception ex) { try { date = simpleDateFormatTimeStamp.parse(dateString); } catch (final ParseException e) { log.info("Could not parse date: " + dateString); try { date = simpleDateFormat.parse(dateString); } catch (final ParseException e1) { log.error(e.getMessage()); throw new SpringBatchLightminApplicationException(e1, e1.getMessage()); } } } return date; }
DomainParameterParser { public static Date parseDate(final String dateString) { Date date; try { date = new Date(Long.parseLong(dateString)); } catch (final Exception ex) { try { date = simpleDateFormatTimeStamp.parse(dateString); } catch (final ParseException e) { log.info("Could not parse date: " + dateString); try { date = simpleDateFormat.parse(dateString); } catch (final ParseException e1) { log.error(e.getMessage()); throw new SpringBatchLightminApplicationException(e1, e1.getMessage()); } } } return date; } }
DomainParameterParser { public static Date parseDate(final String dateString) { Date date; try { date = new Date(Long.parseLong(dateString)); } catch (final Exception ex) { try { date = simpleDateFormatTimeStamp.parse(dateString); } catch (final ParseException e) { log.info("Could not parse date: " + dateString); try { date = simpleDateFormat.parse(dateString); } catch (final ParseException e1) { log.error(e.getMessage()); throw new SpringBatchLightminApplicationException(e1, e1.getMessage()); } } } return date; } private  DomainParameterParser(); }
DomainParameterParser { public static Date parseDate(final String dateString) { Date date; try { date = new Date(Long.parseLong(dateString)); } catch (final Exception ex) { try { date = simpleDateFormatTimeStamp.parse(dateString); } catch (final ParseException e) { log.info("Could not parse date: " + dateString); try { date = simpleDateFormat.parse(dateString); } catch (final ParseException e1) { log.error(e.getMessage()); throw new SpringBatchLightminApplicationException(e1, e1.getMessage()); } } } return date; } private  DomainParameterParser(); static String parseParameterMapToString(final Map<String, Object> parametersMap); static void parseParameterEntryToString(final StringBuilder stringBuilder, final Entry<String, Object> entry); static JobParameters parseParametersToJobParameters(final String parameters); static Map<String, Object> parseParameters(final String parameters); static String parseJobParametersToString(final JobParameters jobParameters); static Entry<String, Object> generateParameterEntry(final String parameter); static Object createValueInstance(final String type, final String valueString); static Date parseDate(final String dateString); static String parseDate(final Date date); }
DomainParameterParser { public static Date parseDate(final String dateString) { Date date; try { date = new Date(Long.parseLong(dateString)); } catch (final Exception ex) { try { date = simpleDateFormatTimeStamp.parse(dateString); } catch (final ParseException e) { log.info("Could not parse date: " + dateString); try { date = simpleDateFormat.parse(dateString); } catch (final ParseException e1) { log.error(e.getMessage()); throw new SpringBatchLightminApplicationException(e1, e1.getMessage()); } } } return date; } private  DomainParameterParser(); static String parseParameterMapToString(final Map<String, Object> parametersMap); static void parseParameterEntryToString(final StringBuilder stringBuilder, final Entry<String, Object> entry); static JobParameters parseParametersToJobParameters(final String parameters); static Map<String, Object> parseParameters(final String parameters); static String parseJobParametersToString(final JobParameters jobParameters); static Entry<String, Object> generateParameterEntry(final String parameter); static Object createValueInstance(final String type, final String valueString); static Date parseDate(final String dateString); static String parseDate(final Date date); static final String DATE_FORMAT_WITH_TIMESTAMP; static final String DATE_FORMAT; }