The name could use some tweaking, but the idea itself looks good
Deaar allI was thinking about, how we can separate Validity from the instances, e.g. CurrencyUnit (one of the key feedback points out of the EDR). As attachment find my proposal how we can achieve that:
- The Validity value type defines a validity for any item where it can be used: CurrencyUnit, but also ExchangeRate.
- I defined another interface Validateable which can be implemented by classes that support validity ranges. I suggest hereby that
- CurrencyUnit will NOT extend this interface. Basically this leads to a very lean CurrencyUnit, which basically only extends the current Currency class by namespaces, the general legal tender and virtual flags (see also attached interface). As a side effect the implementation of equals/hashCode also gets simple.
- ExchangeRate would implement this interface.
- Additionally for the MonetaryCurrencies singleton, within the ext package a ValidatedCurrencyUnit class can be implemented that extends CurrencyUnit with Validateable.
- Similarly a ValideatableAmount class can be added that combines validity with a MonetaryAmount.I know that not all details were worked out, but I think, it is worth starting the discussion given the two interfaces attached and the comments above. So the discussion is open!Cheers,Anatole--
[JSR-354] Re: Separation of Validity
|Mark Davis ☕||06/09/2013|