I have just checked in a set of single field period classes:
Years
Months
Weeks
Days
Hours
Minutes
Seconds

These are intended to allow more typesafety on those APIs that require 
just one field type, and to provide convenient mthdods to convert 
between the different types assuming standard lengths like a 24 hour day 
and a 60 second minute.

Feedback welcomed!
Stephen


Stephen Colebourne wrote:
> I have been considering the possibility of adding a set of seven period 
> classes to the API, to represent the main duration types. The new 
> classes would be Years, Months, Weeks, Days, Hours, Minutes and Seconds. 
> These would implement ReadablePeriod, and be simple type-safe single 
> duration type classes.
> 
> An example usage would be a website offering a date search 'plus or 
> minus 3 days'. Holding a Period object here is misleading as 
> years/months/weeks/hours have no meaning to the use case. Thus a 
> specific Days class becomes useful. Other use cases would include other 
> types of scheduling application.
> 
> I have built a version for Days with the following API:
> static between(ReadableInstant, ReadableInstant)
> static between(ReadablePartial, ReadablePartial)
> static parse(String)
> Days(int)
> Days(ReadablePeriod)
> getPeriodType()
> size()
> get(DurationFieldType)
> isSupported(DurationFieldType)
> getFieldType(int)
> getValue(int)
> toPeriod()
> toMutablePeriod()
> getDays()
> plus(int)
> plus(Days)
> minus(int)
> minus(Days)
> multipliedBy(int)
> dividedBy(int)
> negate()
> equals(Object)
> hashCode()
> compareTo(Object)
> toString()
> 
> This seems to cover the basic required features. Are there any missing?
> 
> Feedback welcomed as to whether this will prove useful, or is too 
> specific for inclusion.
> 
> Stephen
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to