Skip to main content

[JSR-354] Factor out Validity Services

  • From: Anatole Tresch <atsticks@...>
  • To: Jsr 354 JavaMoney Public Mailinglist <jcurrency_mail@...>, Greg Bakos <greg@...>
  • Subject: [JSR-354] Factor out Validity Services
  • Date: Sat, 24 Aug 2013 22:35:33 +0200

Dear all

when writing on the spec this morning, I felt not satisfied, with our
solutions how validities for currencies and regions were handled.
Basically, with ValidityInfo and RelatedValidityInfo we already have a
generalized solution for the return types. But the accessor methods were
specific on the MonetaryCurrencies and Regions singletons.

Therefore I created (in ext) an additional Validities singleton, which
provides validities as required. But I still was not satisfied, since there
were a lots of access methods that did more or less the same, just varying
the input parameters a bit. Additionally we also support querying of legal
tender related validities, which are different than the normal currencies
per region relation. So I was looking for a more flexible solution and came
to ValidityQuery and RelatedValidityQuery.

The distinction what kind of ValidityInfo is required, I solved by
adding a ValidityType
value type. By default this is set to ValidityType.EXISTENCE, but for legal
tenders or other use cases may have different values.

Basically I see not many disadvantages, but many advantages:

   - Validities are not constrained to currencies and regions anymore, also
   other types can be supported, by simply registering corresponding
ValidityProviderSpi
   instances.
   - Queries can be extended, when useful (must be supported by the
   provider answering the query of course), so also very complex customer
   specific use cases can be modelled.
   - The client API is simple (4 methods).
   - Even bitermporal historization would be possible, by adding an
   additional parameter.

I have attached the according new files.

See also: https://java.net/jira/browse/JAVAMONEY-59

Cheers,
Anatole


-- 
*Anatole Tresch*
Java Lead Engineer, JSR Spec Lead
Gl√§rnischweg 10
CH - 8620 Wetzikon

*Switzerland, Europe Zurich, GMT+1*
*Twitter:  @atsticks*
*Blogs: **http://javaremarkables.blogspot.ch/*
*Google: atsticks
Mobile  +41-76 344 62 79*

Attachment: RelatedValidityProviderSpi.java
Description: Binary data

Attachment: ValiditiesSingletonSpi.java
Description: Binary data

Attachment: ValidityProviderSpi.java
Description: Binary data

Attachment: RelatedValidityInfo.java
Description: Binary data

Attachment: RelatedValidityQuery.java
Description: Binary data

Attachment: Validities.java
Description: Binary data

Attachment: ValidityInfo.java
Description: Binary data

Attachment: ValidityQuery.java
Description: Binary data

Attachment: ValidityType.java
Description: Binary data



[JSR-354] Factor out Validity Services

Anatole Tresch 08/24/2013
 
 
Close
loading
Please Confirm
Close