Record Class LocaleSettings

java.lang.Object
java.lang.Record
com.nsdev.lettergenerator.localization.LocaleSettings
Record Components:
languageTag - BCP 47 locale; null defaults to en-GB
datePattern - optional explicit date pattern
dateStyle - localized date style; null means LONG
currencyCode - optional ISO currency code; otherwise derived from the locale country
zoneId - 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 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 default
      datePattern - optional exact pattern
      dateStyle - optional localized style
      currencyCode - optional ISO currency
      zoneId - optional explicit zone
    • LocaleSettings

      public LocaleSettings(String languageTag)
      Uses localized long dates, country currency and UTC.
      Parameters:
      languageTag - explicit locale language tag
  • Method Details

    • defaults

      public static LocaleSettings defaults()
      Returns:
      stable British English formatting
    • locale

      public Locale locale()
      Returns:
      explicitly configured Java locale
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • languageTag

      public String languageTag()
      Returns the value of the languageTag record component.
      Returns:
      the value of the languageTag record component
    • datePattern

      public String datePattern()
      Returns the value of the datePattern record component.
      Returns:
      the value of the datePattern record component
    • dateStyle

      public FormatStyle dateStyle()
      Returns the value of the dateStyle record component.
      Returns:
      the value of the dateStyle record component
    • currencyCode

      public String currencyCode()
      Returns the value of the currencyCode record component.
      Returns:
      the value of the currencyCode record component
    • zoneId

      public String zoneId()
      Returns the value of the zoneId record component.
      Returns:
      the value of the zoneId record component