@Test public void testConvert__illegalArgument() { Object[] illegals = {new BigDecimal(7), new Integer(1), "abc"}; for (Object obj : illegals) { try { type.convert(obj); fail(); } catch (IllegalArgumentException e) { } } }
@Override public DateHolder convert(Object obj) { if (obj instanceof Date) { return new DateHolder((Date) obj); } if (obj instanceof Calendar) { Calendar cal = (Calendar) obj; return new DateHolder(cal.getTime()); } if (obj == null) { return new DateHolder(null); } if (obj instanceof String) { return decode((String) obj); } throw new IllegalArgumentException("conversion not supported for: " + obj.getClass()); }
DateType implements Type<DateHolder> { @Override public DateHolder convert(Object obj) { if (obj instanceof Date) { return new DateHolder((Date) obj); } if (obj instanceof Calendar) { Calendar cal = (Calendar) obj; return new DateHolder(cal.getTime()); } if (obj == null) { return new DateHolder(null); } if (obj instanceof String) { return decode((String) obj); } throw new IllegalArgumentException("conversion not supported for: " + obj.getClass()); } }
DateType implements Type<DateHolder> { @Override public DateHolder convert(Object obj) { if (obj instanceof Date) { return new DateHolder((Date) obj); } if (obj instanceof Calendar) { Calendar cal = (Calendar) obj; return new DateHolder(cal.getTime()); } if (obj == null) { return new DateHolder(null); } if (obj instanceof String) { return decode((String) obj); } throw new IllegalArgumentException("conversion not supported for: " + obj.getClass()); }  }
DateType implements Type<DateHolder> { @Override public DateHolder convert(Object obj) { if (obj instanceof Date) { return new DateHolder((Date) obj); } if (obj instanceof Calendar) { Calendar cal = (Calendar) obj; return new DateHolder(cal.getTime()); } if (obj == null) { return new DateHolder(null); } if (obj instanceof String) { return decode((String) obj); } throw new IllegalArgumentException("conversion not supported for: " + obj.getClass()); }  @Override String encode(DateHolder holder); @Override DateHolder decode(String text); @Override DateHolder convert(Object obj); @Override DateHolder[] newArray(int size); static void setDefaultOutputPattern(String pattern); static String getDefaultOutputPattern(); }
DateType implements Type<DateHolder> { @Override public DateHolder convert(Object obj) { if (obj instanceof Date) { return new DateHolder((Date) obj); } if (obj instanceof Calendar) { Calendar cal = (Calendar) obj; return new DateHolder(cal.getTime()); } if (obj == null) { return new DateHolder(null); } if (obj instanceof String) { return decode((String) obj); } throw new IllegalArgumentException("conversion not supported for: " + obj.getClass()); }  @Override String encode(DateHolder holder); @Override DateHolder decode(String text); @Override DateHolder convert(Object obj); @Override DateHolder[] newArray(int size); static void setDefaultOutputPattern(String pattern); static String getDefaultOutputPattern(); static final String TYPE_NAME; }