Class SimplePersonName
java.lang.Object
com.ibm.icu.text.SimplePersonName
- All Implemented Interfaces:
PersonName
A concrete implementation of PersonNameFormatter.PersonName that simply stores the field values
in a Map.
A caller can store both raw field values (such as "given") and modified field values (such as "given-informal") in a SimplePersonName. But beyond storing and returning modified field values provided to it by the caller, SimplePersonName relies on the PersonNameFormatter's default handling of field modifiers.
- Status:
- Stable ICU 73.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA utility class for constructing a SimplePersonName.Nested classes/interfaces inherited from interface PersonName
PersonName.FieldModifier, PersonName.NameField, PersonName.PreferredOrderModifier and TypeInterfaceDescriptionstatic enumIdentifiers for the name field modifiers supported by the PersonName and PersonNameFormatter objects.static enumIdentifiers for the name fields supported by the PersonName object.static enumAn enum to specify the preferred field order for the name. -
Method Summary
Modifier and TypeMethodDescriptionstatic SimplePersonName.Builderbuilder()Returns a Builder object that can be used to construct a new SimplePersonName object.getFieldValue(PersonName.NameField nameField, Set<PersonName.FieldModifier> modifiers) Returns one field of the name, possibly in a modified form.Returns the locale of the name-- that is, the language or country of origin for the person being named.Returns the preferred field order for the name.toString()
-
Method Details
-
builder
Returns a Builder object that can be used to construct a new SimplePersonName object.- Returns:
- A Builder object that can be used to construct a new SimplePersonName object.
- Status:
- Stable ICU 73.
-
getNameLocale
Returns the locale of the name-- that is, the language or country of origin for the person being named.- Specified by:
getNameLocalein interfacePersonName- Returns:
- The name's locale, or null if it's unknown.
- Status:
- Stable ICU 73.
-
getPreferredOrder
Returns the preferred field order for the name. This will be DEFAULT, unless the caller sets it to something else using the builder.- Specified by:
getPreferredOrderin interfacePersonName- Returns:
- The name's preferred field order.
- Status:
- Stable ICU 73.
-
getFieldValue
public String getFieldValue(PersonName.NameField nameField, Set<PersonName.FieldModifier> modifiers) Returns one field of the name, possibly in a modified form. This class can store modified versions of fields, provided at construction time, and this function will return them. Otherwise, it ignores modifiers and relies on PersonNameFormat's default modifier handling.- Specified by:
getFieldValuein interfacePersonName- Parameters:
nameField- The identifier of the requested field.modifiers- An IN/OUT parameter that specifies modifiers to apply to the basic field value. On return, this list will contain any modifiers that this object didn't handle. This class will always return this set unmodified, unless a modified version of the requested field was provided at construction time.- Returns:
- The value of the requested field, optionally modified by some or all of the requested modifiers, or null if the requested field isn't present in the name.
- Status:
- Stable ICU 73.
-
toString
-