@Test public void testGetFromCVAllDay2() { ContentValues values = new ContentValues(); FieldAdapter<Iterable<DateTime>, ?> adapter = new DateTimeIterableFieldAdapter<TaskAdapter>("x", "y"); values.put("x", "20180109,20180110"); assertThat(adapter.getFrom(values), iteratesTo(DateTime.parse("20180109"), DateTime.parse("20180110"))); }
@Override public Iterable<DateTime> getFrom(ContentValues values) { String datetimeList = values.getAsString(mDateTimeListFieldName); if (datetimeList == null) { return EmptyIterable.instance(); } String timezoneString = mTimeZoneFieldName == null ? null : values.getAsString(mTimeZoneFieldName); TimeZone timeZone = timezoneString == null ? null : TimeZone.getTimeZone(timezoneString); return new DateTimeList(timeZone, datetimeList); }
DateTimeIterableFieldAdapter extends SimpleFieldAdapter<Iterable<DateTime>, EntityType> { @Override public Iterable<DateTime> getFrom(ContentValues values) { String datetimeList = values.getAsString(mDateTimeListFieldName); if (datetimeList == null) { return EmptyIterable.instance(); } String timezoneString = mTimeZoneFieldName == null ? null : values.getAsString(mTimeZoneFieldName); TimeZone timeZone = timezoneString == null ? null : TimeZone.getTimeZone(timezoneString); return new DateTimeList(timeZone, datetimeList); } }
DateTimeIterableFieldAdapter extends SimpleFieldAdapter<Iterable<DateTime>, EntityType> { @Override public Iterable<DateTime> getFrom(ContentValues values) { String datetimeList = values.getAsString(mDateTimeListFieldName); if (datetimeList == null) { return EmptyIterable.instance(); } String timezoneString = mTimeZoneFieldName == null ? null : values.getAsString(mTimeZoneFieldName); TimeZone timeZone = timezoneString == null ? null : TimeZone.getTimeZone(timezoneString); return new DateTimeList(timeZone, datetimeList); } DateTimeIterableFieldAdapter(String datetimeListFieldName, String timezoneFieldName); }
DateTimeIterableFieldAdapter extends SimpleFieldAdapter<Iterable<DateTime>, EntityType> { @Override public Iterable<DateTime> getFrom(ContentValues values) { String datetimeList = values.getAsString(mDateTimeListFieldName); if (datetimeList == null) { return EmptyIterable.instance(); } String timezoneString = mTimeZoneFieldName == null ? null : values.getAsString(mTimeZoneFieldName); TimeZone timeZone = timezoneString == null ? null : TimeZone.getTimeZone(timezoneString); return new DateTimeList(timeZone, datetimeList); } DateTimeIterableFieldAdapter(String datetimeListFieldName, String timezoneFieldName); @Override Iterable<DateTime> getFrom(ContentValues values); @Override Iterable<DateTime> getFrom(Cursor cursor); @Override Iterable<DateTime> getFrom(Cursor cursor, ContentValues values); @Override void setIn(ContentValues values, Iterable<DateTime> value); }
DateTimeIterableFieldAdapter extends SimpleFieldAdapter<Iterable<DateTime>, EntityType> { @Override public Iterable<DateTime> getFrom(ContentValues values) { String datetimeList = values.getAsString(mDateTimeListFieldName); if (datetimeList == null) { return EmptyIterable.instance(); } String timezoneString = mTimeZoneFieldName == null ? null : values.getAsString(mTimeZoneFieldName); TimeZone timeZone = timezoneString == null ? null : TimeZone.getTimeZone(timezoneString); return new DateTimeList(timeZone, datetimeList); } DateTimeIterableFieldAdapter(String datetimeListFieldName, String timezoneFieldName); @Override Iterable<DateTime> getFrom(ContentValues values); @Override Iterable<DateTime> getFrom(Cursor cursor); @Override Iterable<DateTime> getFrom(Cursor cursor, ContentValues values); @Override void setIn(ContentValues values, Iterable<DateTime> value);  }