1

I'm attempting to build a generic Event class which models a calendar event. The event has either a full start date/time, represented by a Joda DateTime, or just a start date, represented by a Joda LocalDate.

I'd like to make Event generic and simplify a lot of the current if an all-day event then do this otherwise do that logic scattered throughout the code but can't find a superclass of DateTime and LocalDate which still contains useful methods to obtain information such as the start date. Is there some way to do this or do I need to keep my current way of doing things?

4

1 回答 1

0

用以下方式替换 DateTime + LocalDate 怎么样:

org.joda.time.Interval

它本质上是一对可以代表任何事件的开始/结束的瞬间。应涵盖 30 分钟的事件或 5 天的事件。

于 2013-05-31T02:12:04.327 回答