Closed jodastephen closed 11 years ago
What exceptions can ofDateAdjuster throw?
None. The returned adjuster might throw exceptions.
Still not sure that this is worth it yet though.
I think this is worth doing, as pretty much all implementations I can foresee in my day job are date-based, and this method makes writing them significantly easier.
How would it be used? It might lead to adjusters that make incorrect assumptions that are ISO biased, like the days in months, etc. I don't it as that valuable.
I've pointed out many times before that running algorithms or manipulations on dates in an arbitrary/unknown calendar system is risky and likely to go wrong, due to the wide variation in calendar systems. Most business applications (what Java is principally used for) use ISO for algorithms, so making it easier to write correct ISO adjusters is a good thing, not a bad one.
The method would be used to help users write adjusters.
public static TemporalAdjuster TWEAKER = TemporalAdjuster.ofDateAdjuster(date -> { ... });
ok
TemporalAdjuster
is based on the low levelTemporal
, whereas most adjustments want to be written forLocalDate
. Consider the following which may help:Note, its not certain that this necessarily helps, or whether it should be hidden internally as part of a streams API.