I need to be able to create custom calendars that can omit certain holidays which I specify from the date set. I might for instance, need to create a map keyed on the date, but only want to loop through the dates which omit certain holidays. An example would be that I want to see how much electricity in kWH german gov’t buildings used on a given day, but omit the holidays. I thought about using joda-time for this, considering I might have a map keyed like <DateTime, Double>, but I am not sure if that would work.
What would be the best way to go about doing this?
You are using the word Calendar in the “business Calendar” sense, and not in a sense that
java.util.Calendaror a JodaChronologywould understand. Basically, your “Calendar” is the application of rules which sub-select a set of JodaIntervalsfrom a JodaChronology.I believe that you will find that instead of trying to build another business calendar system on top of Joda, you might be better off using ObjectLabKit, which is a business library that has support for business calendars, including holiday rules etc.
Hopefully the rules will support all of the scenarios in your locale. Sometimes different locations don’t share enough of the same assumptions about time to actually use a semi-generic library.