@Test public void testSetInDoubleAllDay() { ContentValues values = new ContentValues(); FieldAdapter<Iterable<DateTime>, ?> adapter = new DateTimeIterableFieldAdapter<TaskAdapter>("x", "y"); adapter.setIn(values, new Seq<>(DateTime.parse("20180109"), DateTime.parse("20180110"))); assertThat(values.getAsString("x"), is("20180109,20180110")); }
@Override public void setIn(ContentValues values, Iterable<DateTime> value) { if (value != null) { String stringValue = TextUtils.join(",", new Mapped<>(dt -> dt.isFloating() ? dt : dt.shiftTimeZone(DateTime.UTC), value)); values.put(mDateTimeListFieldName, stringValue.isEmpty() ? null : stringValue); } else { values.put(mDateTimeListFieldName, (String) null); } }
DateTimeIterableFieldAdapter extends SimpleFieldAdapter<Iterable<DateTime>, EntityType> { @Override public void setIn(ContentValues values, Iterable<DateTime> value) { if (value != null) { String stringValue = TextUtils.join(",", new Mapped<>(dt -> dt.isFloating() ? dt : dt.shiftTimeZone(DateTime.UTC), value)); values.put(mDateTimeListFieldName, stringValue.isEmpty() ? null : stringValue); } else { values.put(mDateTimeListFieldName, (String) null); } } }
DateTimeIterableFieldAdapter extends SimpleFieldAdapter<Iterable<DateTime>, EntityType> { @Override public void setIn(ContentValues values, Iterable<DateTime> value) { if (value != null) { String stringValue = TextUtils.join(",", new Mapped<>(dt -> dt.isFloating() ? dt : dt.shiftTimeZone(DateTime.UTC), value)); values.put(mDateTimeListFieldName, stringValue.isEmpty() ? null : stringValue); } else { values.put(mDateTimeListFieldName, (String) null); } } DateTimeIterableFieldAdapter(String datetimeListFieldName, String timezoneFieldName); }
DateTimeIterableFieldAdapter extends SimpleFieldAdapter<Iterable<DateTime>, EntityType> { @Override public void setIn(ContentValues values, Iterable<DateTime> value) { if (value != null) { String stringValue = TextUtils.join(",", new Mapped<>(dt -> dt.isFloating() ? dt : dt.shiftTimeZone(DateTime.UTC), value)); values.put(mDateTimeListFieldName, stringValue.isEmpty() ? null : stringValue); } else { values.put(mDateTimeListFieldName, (String) null); } } 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 void setIn(ContentValues values, Iterable<DateTime> value) { if (value != null) { String stringValue = TextUtils.join(",", new Mapped<>(dt -> dt.isFloating() ? dt : dt.shiftTimeZone(DateTime.UTC), value)); values.put(mDateTimeListFieldName, stringValue.isEmpty() ? null : stringValue); } else { values.put(mDateTimeListFieldName, (String) null); } } 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);  }