Frameworks to manage dates (effective date and expiry dates)

Posted by user214626 on Stack Overflow See other posts from Stack Overflow or by user214626
Published on 2010-04-05T10:41:42Z Indexed on 2010/04/05 10:43 UTC
Read the original article Hit count: 401

Filed under:
|
|

Hello,

We have an object that can has an effective date and expiry date.(Ex. i want to maintain the price of a commodity for a time period)

Business Rules - Effective date is always a valid date (a datestamp) but, expiry date can be null to indicate that the object is active throughout. Also, both effective and expiry date can be set to some valid dates.

Are there any frameworks that manage objects such that the objects are consistent,i.e there are no overlaps of the validity periods ?

Ex. class XBOX { double price; Date effectiveDate; Date expiryDate; }

XBOX x1 = new XBOX(400$, '2007-01-01','2008-12-31' ); XBOX x2 = new XBOX(200$, '2009-01-01',null );

Assume that we get a new rate from '2010-01-01' and a new XBOX object has to be created (to persist).

Is there a framework/pattern that can do the following, so that the XBOX is consistent.

  1. x2.setExpiryDate('2009-12-31')
  2. XBOX x3 = new XBOX(150$, '2010-01-01',null );

Thanks in advance.

© Stack Overflow or respective owner

Related posts about frameworks

Related posts about date