All,

The user guide suggests that ReadableInstant has a method called toDateTime:

For maximum flexibility however, you might choose to declare your method parameters using the Joda-Time interface. A method on the interface can obtain the concrete class for use within the method.

    public void process(ReadableInstant instant) {
        DateTime dt = instant.toDateTime();
    }

This is, in fact, what I'm trying to do. I've defined my API to accept ReadableInstant. But sometimes I really do want to access fields, so I want to be able to do toDateTime on it. But that method is not present in ReadableInstant.

At first, I thought that it was because Instant doesn't "know" about DateTime, which is further down the class hierarchy. But then I noticed that Instant *does* have a toDateTime method.

Can we please have toDateTime in ReadableInstant?

This change would enable API designers to accept ReadableInstant, as in the user guide example, and convert it to a DateTime for local use, without having to pay a performance penalty for instantiating a new DateTime, in the likely event that the object ReadableInstant instance is already a DateTime, since DateTime.toDateTime returns this.

Thanks,
W

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to