Package net.time4j.engine
Class CalendarFamily.Builder<T extends CalendarVariant<T>>
java.lang.Object
net.time4j.engine.Chronology.Builder<T>
net.time4j.engine.CalendarFamily.Builder<T>
- Type Parameters:
T
- generic type of time context
- Enclosing class:
- CalendarFamily<T extends CalendarVariant<T>>
public static final class CalendarFamily.Builder<T extends CalendarVariant<T>>
extends Chronology.Builder<T>
Creates a builder for a new calendar family and will only be used during loading a class of a calendar variant in a static initializer.
Instances of this class will be created by the static factory method setUp()
.
- Since:
- 3.4/4.3
- Author:
- Meno Hochschild
- See Also:
setUp(Class,ChronoMerger,Map)
-
Method Summary
Modifier and TypeMethodDescription<V> CalendarFamily.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()
Creates and registers a calendar family.static <T extends CalendarVariant<T>>
CalendarFamily.Builder<T>setUp(Class<T> chronoType, ChronoMerger<T> merger, Map<String,? extends CalendarSystem<T>> calendars)
Creates a builder for building a calendar family.Methods inherited from class net.time4j.engine.Chronology.Builder
setUp
-
Method Details
-
setUp
public static <T extends CalendarVariant<T>> CalendarFamily.Builder<T> setUp(Class<T> chronoType, ChronoMerger<T> merger, Map<String,? extends CalendarSystem<T>> calendars)Creates a builder for building a calendar family.
- Type Parameters:
T
- generic type of time context- Parameters:
chronoType
- reified chronological typemerger
- generic replacement for static creation of variant objectscalendars
- map of variant names to calendar systems- Returns:
- new
Builder
object - Throws:
IllegalArgumentException
- if no calendar system is specified- Since:
- 3.4/4.3
-
appendElement
public <V> CalendarFamily.Builder<T> appendElement(ChronoElement<V> element, ElementRule<T,V> rule)Description copied from class:Chronology.Builder
Registers a new element together with its associated element rule.
- Overrides:
appendElement
in classChronology.Builder<T extends CalendarVariant<T>>
- 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
-
appendExtension
Description copied from class:Chronology.Builder
Registers a state extension which can create models with their own state separated from standard time value context.
- Overrides:
appendExtension
in classChronology.Builder<T extends CalendarVariant<T>>
- Parameters:
extension
- chronological extension- Returns:
- this instance for method chaining
-
build
Creates and registers a calendar family.
- Overrides:
build
in classChronology.Builder<T extends CalendarVariant<T>>
- Returns:
- new chronology as calendar family
- Throws:
IllegalStateException
- if already registered or in case of inconsistencies- Since:
- 3.4/4.3
- See Also:
Chronology.lookup(Class)
-