Package net.time4j.engine
Class Chronology.Builder<T extends ChronoEntity<T>>
java.lang.Object
net.time4j.engine.Chronology.Builder<T>
- Type Parameters:
T- generic type of time context
- Direct Known Subclasses:
CalendarFamily.Builder,TimeAxis.Builder
- Enclosing class:
- Chronology<T>
Builder for creating a new chronology without any time axis.
This class will be used during loading of a ChronoEntity-class
T in a static initializer.
- Author:
- Meno Hochschild
-
Method Summary
Modifier and TypeMethodDescription<V> Chronology.Builder<T>appendElement(ChronoElement<V> element, ElementRule<T,V> rule)Registers a new element together with its associated element rule.appendExtension(ChronoExtension extension)Registers a state extension which can create models with their own state separated from standard time value context.build()Finishes the build of a new chronology.static <T extends ChronoEntity<T>>
Chronology.Builder<T>setUp(Class<T> chronoType, ChronoMerger<T> chronoMerger)Creates a builder for building a new chronological system.
-
Method Details
-
setUp
public static <T extends ChronoEntity<T>> Chronology.Builder<T> setUp(Class<T> chronoType, ChronoMerger<T> chronoMerger)Creates a builder for building a new chronological system.
- Type Parameters:
T- generic type of time context- Parameters:
chronoType- chronological typechronoMerger- creates a new instance of T from another source (clock or parsed values)- Returns:
- new
Builderobject - Throws:
UnsupportedOperationException- if T represents a subclass ofTimePoint
-
appendElement
Registers a new element together with its associated element rule.
- Type Parameters:
V- generic type of element value- Parameters:
element- chronological element to be registeredrule- rule associated with the element- Returns:
- this instance for method chaining
- Throws:
IllegalArgumentException- if given element is already registered (duplicate)
-
appendExtension
Registers a state extension which can create models with their own state separated from standard time value context.
- Parameters:
extension- chronological extension- Returns:
- this instance for method chaining
-
build
Finishes the build of a new chronology.
Internally the new chronology will be weakly registered for
lookup(). Therefore it is strongly recommended to reference the created chronology in a static constant within the chronological type in question.- Returns:
- new instance of chronology
- Throws:
IllegalStateException- if already registered- See Also:
Chronology.lookup(Class)
-