class 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());
    }

}