Peter,
Peter Donald wrote:
I would prefer a OneTimeTrigger class. It would mean that the code for the class is simpler and easier to understand IMHO.ok - the separate class does have the advantage of being more intuitive as to its purpose
Instead of exposing TimeScheduleEntry which holds lots of implementation details that should not be exposed. It may be better to return a specially constructed object which people can see detail of. Something likeyes - but perhaps it would be better to make ScheduleEntry an interface that TimeScheduleEntry implements.
public class ScheduleEntry
{
String name; //name registered under
Trigger trigger; //trigger supplied
long nextTime; }
This allows us to change implementation of TimeScheduleEntry without effecting users. It also stops users trying to manipulate Targets that have been scheduled.
Like?
Then in the implementation one can construct and return a new object that implements it (that would ensure as you
say that no one has access to the implementation details of TimeScheduleEntry) or if we do not want to create
too many objects we could return ScheduleEntry with the underlying implementation of TimeScheduleEntry
(but clients would have to know it and typecast it).
Cheers, Mauro
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
