@Test public void testReduceToFieldSpec_withNotNullExclusive_reducesToSpec() { DateTimeGranularity offsetGranularity = DateTimeGranularity.create("MILLIS"); FieldSpecRelation afterDateRelations = new AfterRelation(a, b, true, DateTimeDefaults.get(), offsetGranularity, 1); OffsetDateTime value = OffsetDateTime.of(2000, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); DataBagValue generatedValue = new DataBagValue(value); FieldSpec result = afterDateRelations.createModifierFromOtherValue(generatedValue); Granularity<OffsetDateTime> granularity = new DateTimeGranularity(ChronoUnit.MILLIS); FieldSpec expected = FieldSpecFactory.fromRestriction(new LinearRestrictions<>(granularity.getNext(value), ISO_MAX_DATE, new DateTimeGranularity(ChronoUnit.MILLIS))); assertEquals(expected, result); }
@Override public FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue) { if (otherFieldGeneratedValue.getValue() == null) return FieldSpecFactory.fromType(main.getType()); T offsetValue = offset > 0 ? offsetGranularity.getNext((T) otherFieldGeneratedValue.getValue(), offset) : (T) otherFieldGeneratedValue.getValue(); return createFromMin(offsetValue, defaults.granularity()); }
AfterRelation implements FieldSpecRelation { @Override public FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue) { if (otherFieldGeneratedValue.getValue() == null) return FieldSpecFactory.fromType(main.getType()); T offsetValue = offset > 0 ? offsetGranularity.getNext((T) otherFieldGeneratedValue.getValue(), offset) : (T) otherFieldGeneratedValue.getValue(); return createFromMin(offsetValue, defaults.granularity()); } }
AfterRelation implements FieldSpecRelation { @Override public FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue) { if (otherFieldGeneratedValue.getValue() == null) return FieldSpecFactory.fromType(main.getType()); T offsetValue = offset > 0 ? offsetGranularity.getNext((T) otherFieldGeneratedValue.getValue(), offset) : (T) otherFieldGeneratedValue.getValue(); return createFromMin(offsetValue, defaults.granularity()); } AfterRelation(Field main, Field other, boolean inclusive, LinearDefaults<T> defaults, Granularity<T> offsetGranularity, int offset); }
AfterRelation implements FieldSpecRelation { @Override public FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue) { if (otherFieldGeneratedValue.getValue() == null) return FieldSpecFactory.fromType(main.getType()); T offsetValue = offset > 0 ? offsetGranularity.getNext((T) otherFieldGeneratedValue.getValue(), offset) : (T) otherFieldGeneratedValue.getValue(); return createFromMin(offsetValue, defaults.granularity()); } AfterRelation(Field main, Field other, boolean inclusive, LinearDefaults<T> defaults, Granularity<T> offsetGranularity, int offset); @Override FieldSpec createModifierFromOtherFieldSpec(FieldSpec otherFieldSpec); @Override FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue); @Override Field main(); @Override Field other(); @Override FieldSpecRelation inverse(); @Override String toString(); @Override Constraint negate(); }
AfterRelation implements FieldSpecRelation { @Override public FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue) { if (otherFieldGeneratedValue.getValue() == null) return FieldSpecFactory.fromType(main.getType()); T offsetValue = offset > 0 ? offsetGranularity.getNext((T) otherFieldGeneratedValue.getValue(), offset) : (T) otherFieldGeneratedValue.getValue(); return createFromMin(offsetValue, defaults.granularity()); } AfterRelation(Field main, Field other, boolean inclusive, LinearDefaults<T> defaults, Granularity<T> offsetGranularity, int offset); @Override FieldSpec createModifierFromOtherFieldSpec(FieldSpec otherFieldSpec); @Override FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue); @Override Field main(); @Override Field other(); @Override FieldSpecRelation inverse(); @Override String toString(); @Override Constraint negate();  }