Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If anyone's interested...I've found a work around:</p> <ul> <li>Create a new class e.g. <code>IslamicChronologyWithNames</code> which delegates to an instance of <code>IslamicChronology</code> in package <em>org.joda.time.DateTimeZone</em></li> <li>Modify the one method; <code>assemble(Fields fields)</code>: call the delegate's method and then set fields.monthOfYear (and possibly dayOfWeek) to you own subclass of <code>BasicMonthOfYearDateTimeField</code></li> <li>The subclass of <code>BasicMonthOfYearDateTimeField</code> can then lookup in property files names for the month's (or day's if DayOfWeek...) name. Subclass needs to be in package <em>org.joda.time.chrono</em> to be able to extend <code>BasicMonthOfYearDateTimeField</code>.</li> </ul> <p>There is still an issue that Joda time seems to validate the date you are parsing before calling methods of subclass like <code>getAsText(int fieldValue, Locale locale)</code> and because it has no knowledge of the month names that your class returns, fails validation and so never calls the methods. My work-around was to have a static method in this class which converts a date as a string with islamic month names into a date as a string with gregorian english month names. So before calling <code>parseDateTime()</code>, call the static method and then the date string passes validation. Then, instead of processing Islamic month names in the <code>convertText()</code> method, use the default gregorian implementation inside your subclass:</p> <pre><code>protected int convertText(String text, Locale locale) { return GJLocaleSymbols.forLocale(locale).monthOfYearTextToValue(text); } </code></pre> <p>That should work! Hope it makes sense for anyone who has the same problem.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload