@Test(expected = Error.class) public void testCastBadString() { assertTrue(dateType.cast("badstring") instanceof Date); }
@Override public Object cast(Object obj) { Date value = null; if (obj != null) { DateFormat fmt = Constants.getDateFormat(); if (obj instanceof Date) { value = (Date) obj; } else if (obj instanceof String) { try { value = fmt.parse((String) obj); } catch (ParseException e) { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } else { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } return value; }
DateType implements Type, Serializable { @Override public Object cast(Object obj) { Date value = null; if (obj != null) { DateFormat fmt = Constants.getDateFormat(); if (obj instanceof Date) { value = (Date) obj; } else if (obj instanceof String) { try { value = fmt.parse((String) obj); } catch (ParseException e) { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } else { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } return value; } }
DateType implements Type, Serializable { @Override public Object cast(Object obj) { Date value = null; if (obj != null) { DateFormat fmt = Constants.getDateFormat(); if (obj instanceof Date) { value = (Date) obj; } else if (obj instanceof String) { try { value = fmt.parse((String) obj); } catch (ParseException e) { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } else { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } return value; } private  DateType(); }
DateType implements Type, Serializable { @Override public Object cast(Object obj) { Date value = null; if (obj != null) { DateFormat fmt = Constants.getDateFormat(); if (obj instanceof Date) { value = (Date) obj; } else if (obj instanceof String) { try { value = fmt.parse((String) obj); } catch (ParseException e) { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } else { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } return value; } private  DateType(); @Deprecated static DateFormat getDateFormat(); @Override String getName(); @Override boolean supportsEq(); @Override boolean supportsOrdering(); @Override JsonNode toJson(JsonNodeFactory factory, Object obj); @Override Object fromJson(JsonNode node); @Override Object cast(Object obj); @SuppressWarnings({"rawtypes", "unchecked"}) @Override int compare(Object v1, Object v2); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
DateType implements Type, Serializable { @Override public Object cast(Object obj) { Date value = null; if (obj != null) { DateFormat fmt = Constants.getDateFormat(); if (obj instanceof Date) { value = (Date) obj; } else if (obj instanceof String) { try { value = fmt.parse((String) obj); } catch (ParseException e) { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } else { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } return value; } private  DateType(); @Deprecated static DateFormat getDateFormat(); @Override String getName(); @Override boolean supportsEq(); @Override boolean supportsOrdering(); @Override JsonNode toJson(JsonNodeFactory factory, Object obj); @Override Object fromJson(JsonNode node); @Override Object cast(Object obj); @SuppressWarnings({"rawtypes", "unchecked"}) @Override int compare(Object v1, Object v2); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Deprecated
    static final String DATE_FORMAT_STR; static final Type TYPE; static final String NAME; }