Package net.time4j.format
Class Attributes.Builder
java.lang.Object
net.time4j.format.Attributes.Builder
- Enclosing class:
- Attributes
Builds a collection of format attributes.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Default constructor.Builder(Chronology<?> chronology)Constructor for determining the calendar type. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a new unmodifiable collection of format attributes.remove(AttributeKey<?> key)Removes the specified attribute.<A extends Enum<A>>
Attributes.Builderset(AttributeKey<A> key, A value)Sets an attribute ofenum-type.set(AttributeKey<Boolean> key, boolean value)Sets an attribute ofboolean-type.set(AttributeKey<Character> key, char value)Sets an attribute ofchar-type.set(AttributeKey<Integer> key, int value)Sets an attribute ofint-type.setAll(Attributes attributes)Accepts all given attributes.setCalendarVariant(String variant)Sets the calendar variant.setLanguage(Locale locale)Sets the language.Sets the system timezone reference.setTimezone(String tzid)Sets the timezone reference.setTimezone(TZID tzid)Sets the timezone reference.
-
Constructor Details
-
Builder
public Builder()Default constructor.
-
Builder
Constructor for determining the calendar type.
- Parameters:
chronology- object with possible calendar type- Since:
- 3.0
- See Also:
Attributes.CALENDAR_TYPE
-
-
Method Details
-
setLanguage
Sets the language.
- Parameters:
locale- new language setting- Returns:
- this instance for method chaining
- See Also:
Attributes.LANGUAGE
-
setTimezone
Sets the timezone reference.
- Parameters:
tzid- timezone id- Returns:
- this instance for method chaining
- See Also:
Attributes.TIMEZONE_ID
-
setTimezone
Sets the timezone reference.
- Parameters:
tzid- timezone id- Returns:
- this instance for method chaining
- Throws:
IllegalArgumentException- if given timezone cannot be loaded- Since:
- 1.1
- See Also:
Attributes.TIMEZONE_ID
-
setStdTimezone
Sets the system timezone reference.
- Returns:
- this instance for method chaining
- See Also:
Attributes.TIMEZONE_ID,Timezone.ofSystem()
-
setCalendarVariant
Sets the calendar variant.
- Parameters:
variant- calendar variant- Returns:
- this instance for method chaining
- Since:
- 3.5/4.3
- See Also:
Attributes.CALENDAR_VARIANT,CalendarVariant
-
set
Sets an attribute of
boolean-type.- Parameters:
key- attribute keyvalue- attribute value- Returns:
- this instance for method chaining
-
set
Sets an attribute of
int-type.- Parameters:
key- attribute keyvalue- attribute value- Returns:
- this instance for method chaining
- Throws:
IllegalArgumentException- if an invalid pivot year smaller than100is given
-
set
Sets an attribute of
char-type.- Parameters:
key- attribute keyvalue- attribute value- Returns:
- this instance for method chaining
-
set
Sets an attribute of
enum-type.- Type Parameters:
A- generic type of attribute- Parameters:
key- attribute keyvalue- attribute value- Returns:
- this instance for method chaining
-
setAll
Accepts all given attributes.
If an attribute already exists then it will be overridden.
- Parameters:
attributes- format attributes- Returns:
- this instance for method chaining
-
remove
Removes the specified attribute.
- Parameters:
key- attribute key to be removed- Returns:
- this instance for method chaining
-
build
Creates a new unmodifiable collection of format attributes.
- Returns:
- new instance of
Attributes
-