Frameworks to manage dates (effective date and expiry dates)
- by user214626
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.
x2.setExpiryDate('2009-12-31')
XBOX x3 = new XBOX(150$, '2010-01-01',null );
Thanks in advance.