예제 #1
0
 /**
  * Obtains an instance of {@code Chronology} from a locale.
  * <p>
  * See {@link Chronology#ofLocale(Locale)}.
  *
  * @param Locale $locale the locale to use to obtain the calendar system, not null
  * @return Chronology the calendar system associated with the locale, not null
  * @throws DateTimeException if the locale-specified calendar cannot be found
  */
 static function ofLocale(Locale $locale)
 {
     $type = $locale->getUnicodeLocaleType("ca");
     if ($type == null || "iso" === $type || "iso8601" === $type) {
         return IsoChronology::INSTANCE();
     }
     // Not pre-defined; lookup by the type
     //        do {
     //            Chronology chrono = CHRONOS_BY_TYPE->get(type);
     //            if (chrono != null) {
     //                return chrono;
     //            }
     //            // If not found, do the initialization (once) and repeat the lookup
     //        } while (initCache());
     //
     //// Look for a Chronology using ServiceLoader of the Thread's ContextClassLoader
     //// Application provided Chronologies must not be cached
     //        @SuppressWarnings("rawtypes")
     //        ServiceLoader < Chronology> loader = ServiceLoader->load(Chronology .class);
     //        for (Chronology chrono : $loader) {
     //            if ($type->equals($chrono->getCalendarType())) {
     //                return $chrono;
     //            }
     //        }
     throw new DateTimeException("Unknown calendar system: " . $type);
 }