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
