Class PersonNameFormatter.Builder

java.lang.Object
com.ibm.icu.text.PersonNameFormatter.Builder
Enclosing class:
PersonNameFormatter

public static class PersonNameFormatter.Builder extends Object
A utility class that can be used to construct a PersonNameFormatter. Use PersonNameFormatter.builder() to get a new instance.
  • Method Details

    • setLocale

      public PersonNameFormatter.Builder setLocale(Locale locale)
      Sets the locale for the formatter to be constructed.
      Parameters:
      locale - The new formatter locale. May not be null.
      Returns:
      This builder.
    • setLength

      Sets the name length for the formatter to be constructed.
      Parameters:
      length - The new name length.
      Returns:
      This builder.
    • setUsage

      Sets the name usage for the formatter to be constructed.
      Parameters:
      usage - The new name length.
      Returns:
      This builder.
    • setFormality

      Sets the name formality for the formatter to be constructed.
      Parameters:
      formality - The new name length.
      Returns:
      This builder.
    • setDisplayOrder

      Specifies the desired display order for the formatted names. This can be either SORTING, which requests that names be formatted in a manner suitable for inclusion in a sorted list (e.g., in English, "Smith, John"), or DEFAULT, which gives the standard field order suitable for most contexts (e.g., in English, "John Smith").
      Parameters:
      order - The desired display order for formatted names.
      Returns:
      This builder.
    • setSurnameAllCaps

      public PersonNameFormatter.Builder setSurnameAllCaps(boolean allCaps)
      Requests that the surname in the formatted result be rendered in ALL CAPS. This is often done with Japanese names to highlight which name is the surname.
      Parameters:
      allCaps - If true, the surname in the formatted result will be rendered in ALL CAPS.
      Returns:
      This builder.
    • build

      public PersonNameFormatter build()
      Returns a new PersonNameFormatter with the values that were passed to this builder. This method doesn't freeze or delete the builder; you can call build() more than once (presumably after calling the other methods to change the parameter) to create more than one PersonNameFormatter; you don't need a new Builder for each PersonNameFormatter.
      Returns:
      A new PersonNameFormatter.