public static final class Attributes.Builder extends Object
Builds a collection of format attributes.
| Constructor and Description |
|---|
Builder()
Default constructor.
|
Builder(Chronology<?> chronology)
Constructor for determining the calendar type.
|
| Modifier and Type | Method and Description |
|---|---|
Attributes |
build()
Creates a new unmodifiable collection of format attributes.
|
Attributes.Builder |
remove(AttributeKey<?> key)
Removes the specified attribute.
|
<A extends Enum<A>> |
set(AttributeKey<A> key,
A value)
Sets an attribute of
enum-type. |
Attributes.Builder |
set(AttributeKey<Boolean> key,
boolean value)
Sets an attribute of
boolean-type. |
Attributes.Builder |
set(AttributeKey<Character> key,
char value)
Sets an attribute of
char-type. |
Attributes.Builder |
set(AttributeKey<Integer> key,
int value)
Sets an attribute of
int-type. |
Attributes.Builder |
setAll(Attributes attributes)
Accepts all given attributes.
|
Attributes.Builder |
setCalendarVariant(String variant)
Sets the calendar variant.
|
Attributes.Builder |
setLanguage(Locale locale)
Sets the language.
|
Attributes.Builder |
setStdTimezone()
Sets the system timezone reference.
|
Attributes.Builder |
setTimezone(String tzid)
Sets the timezone reference.
|
Attributes.Builder |
setTimezone(TZID tzid)
Sets the timezone reference.
|
public Builder()
Default constructor.
public Builder(Chronology<?> chronology)
Constructor for determining the calendar type.
chronology - object with possible calendar typeAttributes.CALENDAR_TYPEpublic Attributes.Builder setLanguage(Locale locale)
Sets the language.
locale - new language settingAttributes.LANGUAGEpublic Attributes.Builder setTimezone(TZID tzid)
Sets the timezone reference.
tzid - timezone idAttributes.TIMEZONE_IDpublic Attributes.Builder setTimezone(String tzid)
Sets the timezone reference.
tzid - timezone idIllegalArgumentException - if given timezone cannot be loadedAttributes.TIMEZONE_IDpublic Attributes.Builder setStdTimezone()
Sets the system timezone reference.
Attributes.TIMEZONE_ID,
Timezone.ofSystem()public Attributes.Builder setCalendarVariant(String variant)
Sets the calendar variant.
variant - calendar variantAttributes.CALENDAR_VARIANT,
CalendarVariantpublic Attributes.Builder set(AttributeKey<Boolean> key, boolean value)
Sets an attribute of boolean-type.
key - attribute keyvalue - attribute valuepublic Attributes.Builder set(AttributeKey<Integer> key, int value)
Sets an attribute of int-type.
key - attribute keyvalue - attribute valueIllegalArgumentException - if an invalid pivot year is givenpublic Attributes.Builder set(AttributeKey<Character> key, char value)
Sets an attribute of char-type.
key - attribute keyvalue - attribute valuepublic <A extends Enum<A>> Attributes.Builder set(AttributeKey<A> key, A value)
Sets an attribute of enum-type.
A - generic type of attributekey - attribute keyvalue - attribute valuepublic Attributes.Builder setAll(Attributes attributes)
Accepts all given attributes.
If an attribute already exists then it will be overridden.
attributes - format attributespublic Attributes.Builder remove(AttributeKey<?> key)
Removes the specified attribute.
key - attribute key to be removedpublic Attributes build()
Creates a new unmodifiable collection of format attributes.
AttributesCopyright © 2014–2017. All rights reserved.