/*
* -----------------------------------------------------------------------
* Copyright © 2013-2021 Meno Hochschild,
Represents a system of chronological elements which form any kind * of temporal value.
* * @paramRepräsentiert ein System von chronologischen Elementen, die * zusammen einen zeitlichen Wert formen.
* * @paramUsed by {@code BridgeChronology} only.
* * @param chronoType chronological type * @since 3.24/4.20 */ Chronology(ClassStandard-Konstruktor.
* *Implementierungshinweis: Subklassen sollten grundsätzlich * dem Singleton-Muster folgen und deshalb keinen öffentlichen * Konstruktor bieten.
* * @param chronoType chronological type * @param chronoMerger creates a new instance of T based on infos from another source * @param ruleMap registered elements and rules * @param extensions optional extensions */ @SuppressWarnings("unchecked") Chronology( ClassReturns the chronological type.
* * @return type of time context */ /*[deutsch] *Liefert den chronologischen Typ.
* * @return type of time context */ public ClassReturns all registered chronological elements.
* * @return unmodifiable set of elements without duplicates */ /*[deutsch] *Liefert den zu dieser Chronologie zugehörigen Satz * von registrierten chronologischen Elementen.
* * @return unmodifiable set of elements without duplicates */ public SetQueries if given chronological element is registered together * with its element rule.
* * @param element element to be asked (optional) * @return {@code true} if registered else {@code false} */ /*[deutsch] *Ist das angegebene chronologische Element inklusive Regel * registriert?
* * @param element element to be asked (optional) * @return {@code true} if registered else {@code false} */ public boolean isRegistered(ChronoElement> element) { return ((element != null) && this.ruleMap.containsKey(element)); } /** *Queries if given chronological element is supported by this * chronology.
* *The element will be supported if it is either registered or * defines a suitable element rule for this chronology.
* * @param element element to be asked (optional) * @return {@code true} if supported else {@code false} */ /*[deutsch] *Wird das angegebene chronologische Element unterstützt?
* *Unterstützung ist gegeben, wenn das Element entweder registriert * ist oder eine zu dieser Chronologie passende Regel definiert.
* * @param element element to be asked (optional) * @return {@code true} if supported else {@code false} */ public boolean isSupported(ChronoElement> element) { if (element == null) { return false; } else { return ( this.isRegistered(element) || (this.getDerivedRule(element, false) != null) ); } } @Override public T createFrom( TimeSource> clock, AttributeQuery attributes ) { return this.merger.createFrom(clock, attributes); } @Override public T createFrom( ChronoEntity> entity, AttributeQuery attributes, boolean lenient, boolean preparsing ) { return this.merger.createFrom(entity, attributes, lenient, preparsing); } @Override public ChronoDisplay preformat( T context, AttributeQuery attributes ) { return this.merger.preformat(context, attributes); } @Override public Chronology> preparser() { return this.merger.preparser(); } @Override public String getFormatPattern( FormatStyle style, Locale locale ) { return this.merger.getFormatPattern(style, locale); } @Override public StartOfDay getDefaultStartOfDay() { return this.merger.getDefaultStartOfDay(); } @Override public int getDefaultPivotYear() { return this.merger.getDefaultPivotYear(); } /** *Returns all registered chronological extensions.
* *This method will be called by format-API in order to collect * all extension elements which are relevant for formatting.
* * @return unmodifiable list of extensions */ /*[deutsch] *Liefert die registrierten chronologischen Erweiterungen.
* *Diese Methode wird vom Format-API aufgerufen, um zusätzlich * zu den registrierten Elementen auch alle Erweiterungselemente zu * sammeln, die für die Formatierung von Bedeutung sind.
* * @return unmodifiable list of extensions */ public ListQueries if this chronology has a calendar system.
* * @return {@code true} if this chronology has a calendar system else {@code false} * @see #getCalendarSystem() */ /*[deutsch] *Ermittelt, ob diese Chronologie ein Kalendersystem hat.
* * @return {@code true} if this chronology has a calendar system else {@code false} * @see #getCalendarSystem() */ public boolean hasCalendarSystem() { return false; } /** *Returns the associated calendar system if available.
* * @return calendar system, not {@code null} * @throws ChronoException if the calendar system is unavailable or if there is more than one variant * @see #hasCalendarSystem() */ /*[deutsch] *Liefert das assoziierte Kalendersystem, wenn verfügbar.
* * @return calendar system, not {@code null} * @throws ChronoException if the calendar system is unavailable or if there is more than one variant * @see #hasCalendarSystem() */ public CalendarSystemReturns the calendar system for given calendar variant if available.
* * @param variant name of calendar variant * @return calendar system, not {@code null} * @throws ChronoException if a calendar system is unavailable for given variant (invalid variant name) * @since 3.4/4.3 * @see CalendarVariant#getVariant() */ /*[deutsch] *Liefert das Kalendersystem zur angegebenen Kalendervariante, wenn verfügbar.
* * @param variant name of calendar variant * @return calendar system, not {@code null} * @throws ChronoException if a calendar system is unavailable for given variant (invalid variant name) * @since 3.4/4.3 * @see CalendarVariant#getVariant() */ public CalendarSystemReturns the calendar system for given calendar variant if available.
* * @param variant name of calendar variant * @return calendar system, not {@code null} * @throws ChronoException if a calendar system is unavailable for given variant (invalid variant name) * @since 5.0 */ /*[deutsch] *Liefert das Kalendersystem zur angegebenen Kalendervariante, wenn verfügbar.
* * @param variant name of calendar variant * @return calendar system, not {@code null} * @throws ChronoException if a calendar system is unavailable for given variant (invalid variant name) * @since 5.0 */ public final CalendarSystemReturns a typed singleton per {@code ChronoEntity}-class.
* * @paramLiefert ein getyptes Singleton pro {@code ChronoEntity}-Klasse.
* * @paramRegistriert die angegebene Chronologie.
* *Die Registrierung ist zur Unterstützung der Methode {@link #lookup(Class)} gedacht und wird * einmalig nach Konstruktion einer Chronologie während des Ladens der assoziierten Entitätsklasse * aufgerufen.
* * @param chronology new instance to be registered */ static void register(Chronology> chronology) { CHRONOS.add(new ChronoReference(chronology, QUEUE)); } /** *Bestimmt eine chronologische Regel zum angegebenen Element.
* * @paramBestimmt eine chronologische int-basierte Regel zum angegebenen Element.
* * @param element chronologisches Element * @return Regelobjekt oder {@code null} wenn nicht vorhanden * @since 3.15/4.12 */ IntElementRuleBuilder for creating a new chronology without any time axis. * *
This class will be used during loading of a {@code ChronoEntity}-class * T in a static initializer.
* * @paramErzeugt eine neue Chronologie ohne Zeitachse und wird * beim Laden einer {@code ChronoEntity}-Klasse T in einem * static initializer benutzt.
* * @paramKonstruiert eine neue Instanz.
* * @param chronoType chronological type * @param merger creates a new instance of T from another * source (clock or parsed values) */ Builder( ClassCreates a builder for building a new chronological system.
* * @paramErzeugt ein Hilfsobjekt zum Bauen eines chronologischen * Systems.
* * @paramRegisters a new element together with its associated * element rule.
* * @paramRegistriert ein neues Element mitsamt der assoziierten Regel.
* * @paramRegisters a state extension which can create models with their * own state separated from standard time value context.
* * @param extension chronological extension * @return this instance for method chaining */ /*[deutsch] *Registriert eine Zustandserweiterung, die Modelle mit einem * eigenen Zustand separat vom Zeitwertkontext erzeugen kann.
* * @param extension chronological extension * @return this instance for method chaining */ public BuilderFinishes the build of a new chronology.
* *Internally the new chronology will be weakly registered for * {@code lookup()}. Therefore it is strongly recommended to * reference the created chronology in a static constant within * the chronological type in question.
* * @return new instance of chronology * @throws IllegalStateException if already registered * @see Chronology#lookup(Class) */ /*[deutsch] *Schließt den Build-Vorgang ab.
* *Intern wird die neue Chronologie für {@code lookup()} * schwach registriert. Es wird daher empfohlen, daß eine * Anwendung zusätzlich die erzeugte Chronologie in einer * eigenen statischen Konstanten referenziert.
* * @return new instance of chronology * @throws IllegalStateException if already registered * @see Chronology#lookup(Class) */ public Chronology