• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Joda LocalTime attribute in ERRest
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Joda LocalTime attribute in ERRest


  • Subject: Joda LocalTime attribute in ERRest
  • From: Paul Hoadley <email@hidden>
  • Date: Wed, 16 Sep 2015 10:12:00 +0930

Hello,

I have an entity that uses both Joda LocalDate and LocalTime attributes. I’m using ERRest to serialise these EOs.

LocalDate works fine under all circumstances. LocalTime seems to be serialising to XML and plist correctly, but causes the JSON serialiser to lose its mind.

INFO  net.sf.json.JSONObject  - Property 'field' of class org.joda.time.LocalTime has no read method. SKIPPED
INFO  net.sf.json.JSONObject  - Property 'fieldType' of class org.joda.time.LocalTime has no read method. SKIPPED
INFO  net.sf.json.JSONObject  - Property 'millis' of class org.joda.time.field.PreciseDurationField has no read method. SKIPPED
INFO  net.sf.json.JSONObject  - Property 'millis' of class org.joda.time.field.PreciseDurationField has no read method. SKIPPED
INFO  net.sf.json.JSONObject  - Property 'millis' of class org.joda.time.field.PreciseDurationField has no read method. SKIPPED

And so on. The output looks like this:

"endTime":{"chronology":{"zone":{"ID":"UTC","fixed":true}},"fieldTypes":[{"durationType":{"name":"hours"},"name":"hourOfDay","rangeDurationType":{"name":"days"}},{"durationType":{"name":"minutes"},"name":"minuteOfHour","rangeDurationType":{"name":"hours"}},{"durationType”: ...

Naturally, JSON is the output format I actually want.

What are my options here? I find it hard to believe that NSPropertyListSerialization knows how to handle Joda LocalTime specifically, so why is it getting the output right and the JSON serialiser isn’t? Is there an easy way to add custom types to ERRest? It looks like LocalDate formatting is handled in ERXRestUtils. Is that the only way to handle formatting a LocalTime?

(I probably won’t need two-way handling of these LocalTimes, so I could actually add a cover method on the EO to format the value as a String. But it would be nice if I could do this the Right Way.)


-- 
Paul Hoadley
http://logicsquad.net/



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Joda LocalTime attribute in ERRest
      • From: Paul Hoadley <email@hidden>
  • Prev by Date: [ANN] Wonder 6.1.4
  • Next by Date: Re: WO Maven getting started
  • Previous by thread: [ANN] Wonder 6.1.4
  • Next by thread: Re: Joda LocalTime attribute in ERRest
  • Index(es):
    • Date
    • Thread