Willis Blackburn wrote:
> 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.

Oops!

> 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?

Unfortunately not, as that would be a backwards incompatible change. You 
could use a ReadableDateTime, which does have the method, or do new 
DateTime(readableInstant), which is obviously less than ideal.

Note that readableInstant.toInstant().toDateTime() won't work as it 
loses the time zone and chronology.

Stephen

-------------------------------------------------------------------------
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