Record Class LocaleSettings
java.lang.Object
java.lang.Record
com.nsdev.lettergenerator.localization.LocaleSettings
- Record Components:
languageTag- BCP 47 locale; null defaults to en-GBdatePattern- optional explicit date patterndateStyle- localized date style; null means LONGcurrencyCode- optional ISO currency code; otherwise derived from the locale countryzoneId- explicit time zone; null means UTC
public record LocaleSettings(String languageTag, String datePattern, FormatStyle dateStyle, String currencyCode, String zoneId)
extends Record
Deterministic per-document formatting, independent of JVM defaults.
-
Constructor Summary
ConstructorsConstructorDescriptionLocaleSettings(String languageTag) Uses localized long dates, country currency and UTC.LocaleSettings(String languageTag, String datePattern, FormatStyle dateStyle, String currencyCode, String zoneId) Validates and normalizes formatting choices immediately. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecurrencyCoderecord component.Returns the value of thedatePatternrecord component.Returns the value of thedateStylerecord component.static LocaleSettingsdefaults()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thelanguageTagrecord component.locale()final StringtoString()Returns a string representation of this record class.zoneId()Returns the value of thezoneIdrecord component.
-
Constructor Details
-
LocaleSettings
public LocaleSettings(String languageTag, String datePattern, FormatStyle dateStyle, String currencyCode, String zoneId) Validates and normalizes formatting choices immediately.- Parameters:
languageTag- explicit language tag or stable defaultdatePattern- optional exact patterndateStyle- optional localized stylecurrencyCode- optional ISO currencyzoneId- optional explicit zone
-
LocaleSettings
Uses localized long dates, country currency and UTC.- Parameters:
languageTag- explicit locale language tag
-
-
Method Details
-
defaults
- Returns:
- stable British English formatting
-
locale
- Returns:
- explicitly configured Java locale
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
languageTag
Returns the value of thelanguageTagrecord component.- Returns:
- the value of the
languageTagrecord component
-
datePattern
Returns the value of thedatePatternrecord component.- Returns:
- the value of the
datePatternrecord component
-
dateStyle
Returns the value of thedateStylerecord component.- Returns:
- the value of the
dateStylerecord component
-
currencyCode
Returns the value of thecurrencyCoderecord component.- Returns:
- the value of the
currencyCoderecord component
-
zoneId
Returns the value of thezoneIdrecord component.- Returns:
- the value of the
zoneIdrecord component
-