Perhaps is more difficult to implement or implies a solution not properly thought, but what about the annotation representing an Interval? It could represent numeric intervals or date intervals.
For example, @Interval(name="Bedrooms", inclusive=true) private Integer minBedrooms; @Interval(name="Bedrooms", inclusive=true) Private Integer maxBedrooms; @Interval(name="Renting Period", inclusive=true) private Date rentingFromDate; @Interval(name="Renting Period", inclusive=false) private Date rentingToDate; The viewer could render them together as: Bedrooms: 1 - 5 Renting Period: 1-Aug-2013 - 1-sep-2013 (Not inclusive) Enviado desde mi iPhone El 17/05/2013, a las 02:41, Freddijanto <[email protected]> escribió: > @DateRenderedAsInclusive ? > > > On 17/05/2013 04:46, Dan Haywood wrote: >> The Estatio app that Jeroen and I are developing has quite a number of date >> ranges. >> >> Internally we want to store these as a pair of dates, with inclusive start, >> exclusive end. For example [1-apr-2013, 1-jul-2013) represents all of Q2. >> >> However, on the UI our users want the end date to be the inclusive. In >> other words, [1-apr-2013, 30-jun-2013]. >> >> Probably the best solution to this is to have proper support for Joda's >> Interval class. But that's quite a lot of work that we don't want to get >> into for now. (Especially because we have open-ended intervals, ie where >> null end date implies infinity). >> >> Rather than polluting our domain code with lots of +1day/-1day nonsense, a >> simpler solution we came up with was a new annotation that could be applied >> to the end date, so that it is stored exclusive (1-jul-2013) but is >> rendered 1 day before (30-jun-2013). Neat, huh? >> >> Question is: what to call this annotation. Right now I have chosen >> "@RenderedAdjusted": >> >> public LocalDate getStartDate() { ... } >> >> @RenderedAdjusted >> public LocalDate getEndDate() { ... } >> >> But I don't like it as a name; too clunky. >> >> Other names I've though of are: >> * @Adjusted (a bit misleading) >> * @EndDate (a bit literal?) >> * @ExclusiveDate (a bit obscure) >> * @ExclusiveDateRenderedAsInclusive (too long) >> >> If anyone has a better name, please shout! >> >> Thx >> Dan >
