@Test public void testGetWindowStartCeiling() throws Exception { DateTime currentTime = new DateTime(); final String json = String.format( "{ \"operator\": \"last\", \"currentTime\": %d, \"roundingMode\": \"CEILING\", \"duration\": \"1h\" }", currentTime.getMillis() ); LastFilter lastFilter = objectMapper.readValue(json, LastFilter.class); TimeWindow timeWindow = lastFilter.getWindow(); Assert.assertEquals("_timestamp", lastFilter.getField()); Assert.assertEquals(currentTime.getMillis(), lastFilter.getCurrentTime()); Assert.assertEquals(currentTime.withMinuteOfHour(0) .withSecondOfMinute(0) .withMillisOfSecond(0) .getMillis(), timeWindow.getStartTime()); }
@JsonIgnore public TimeWindow getWindow() { return WindowUtil.calculate(currentTime, duration, roundingMode); }
LastFilter extends Filter { @JsonIgnore public TimeWindow getWindow() { return WindowUtil.calculate(currentTime, duration, roundingMode); } }
LastFilter extends Filter { @JsonIgnore public TimeWindow getWindow() { return WindowUtil.calculate(currentTime, duration, roundingMode); } LastFilter(); @Builder  LastFilter(String field, long currentTime, Duration duration, RoundingMode roundingMode); }
LastFilter extends Filter { @JsonIgnore public TimeWindow getWindow() { return WindowUtil.calculate(currentTime, duration, roundingMode); } LastFilter(); @Builder  LastFilter(String field, long currentTime, Duration duration, RoundingMode roundingMode); void setDuration(Duration duration); @Override T accept(FilterVisitor<T> visitor); @JsonIgnore TimeWindow getWindow(); @Override @JsonIgnore boolean isFilterTemporal(); }
LastFilter extends Filter { @JsonIgnore public TimeWindow getWindow() { return WindowUtil.calculate(currentTime, duration, roundingMode); } LastFilter(); @Builder  LastFilter(String field, long currentTime, Duration duration, RoundingMode roundingMode); void setDuration(Duration duration); @Override T accept(FilterVisitor<T> visitor); @JsonIgnore TimeWindow getWindow(); @Override @JsonIgnore boolean isFilterTemporal();  }