/***
 * Excerpted from "Domain-Driven Design Using Naked Objects",
 * published by The Pragmatic Bookshelf.
 * Copyrights apply to this code. It may not be used to create training material, 
 * courses, books, articles, and the like. Contact us if you are in doubt.
 * We make no guarantees that this code is fit for any purpose. 
 * Visit http://www.pragmaticprogrammer.com/titles/dhnako for more book information.
***/
public static final class CalendarIntervalDefaultsProvider
            implements DefaultsProvider<CalendarInterval> {
    public CalendarInterval getDefaultValue() {
        return CalendarInterval.startingFrom(
                calendarService.today().plusDays(1), Duration.days(1));
    }
    private CalendarService calendarService;
    public void setCalendarService(
            final CalendarService calendarService) {
        this.calendarService = calendarService;
    }
}
@Override
public DefaultsProvider<CalendarInterval> getDefaultsProvider() {
    return new CalendarIntervalDefaultsProvider();
}
