Top Description Inners Fields Constructors Methods
com.ibm.icu.text

public Class SimplePersonName

extends Object
implements PersonName
Class Inheritance
All Implemented Interfaces
com.ibm.icu.text.PersonName
Imports
java.util.Collection, .HashMap, .HashSet, .Locale, .Map, .Set, .StringTokenizer, .TreeSet

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.
ICU Status
Draft since ICU 73.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
SimplePersonName.Builder

A utility class for constructing a SimplePersonName.

Field Summary

Modifier and TypeField and Description
private final Map<String, String>
private final Locale
private final PersonName.PreferredOrder

Constructor Summary

AccessConstructor and Description
private
SimplePersonName(Locale nameLocale, PersonName.PreferredOrder preferredOrder, Map<String, String> fieldValues)

Internal constructor used by the Builder object.

Method Summary

Modifier and TypeMethod and Description
public static SimplePersonName.Builder

Returns:

A Builder object that can be used to construct a new SimplePersonName object.
builder
()

Returns a Builder object that can be used to construct a new SimplePersonName object.

public String

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.
getFieldValue
(PersonName.NameField
The identifier of the requested field.
nameField
,
Set<PersonName.FieldModifier>
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.
modifiers
)

Implements com.ibm.icu.text.PersonName.getFieldValue.

Returns one field of the name, possibly in a modified form.
public Locale

Returns:

The name's locale, or null if it's unknown.
getNameLocale
()

Implements com.ibm.icu.text.PersonName.getNameLocale.

Returns the locale of the name-- that is, the language or country of origin for the person being named.
public PersonName.PreferredOrder

Returns:

The name's preferred field order.
getPreferredOrder
()

Implements com.ibm.icu.text.PersonName.getPreferredOrder.

Returns the preferred field order for the name.
private static String
private static Set<PersonName.FieldModifier>
public String
toString()

Overrides java.lang.Object.toString.

Deprecated This API is ICU internal only.
Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

fieldValuesback to summary
private final Map<String, String> fieldValues
nameLocaleback to summary
private final Locale nameLocale
preferredOrderback to summary
private final PersonName.PreferredOrder preferredOrder

Constructor Detail

SimplePersonNameback to summary
private SimplePersonName(Locale nameLocale, PersonName.PreferredOrder preferredOrder, Map<String, String> fieldValues)

Internal constructor used by the Builder object.

Method Detail

builderback to summary
public static SimplePersonName.Builder builder()

Returns a Builder object that can be used to construct a new SimplePersonName object.

Returns:SimplePersonName.Builder

A Builder object that can be used to construct a new SimplePersonName object.

ICU Status
Draft since ICU 73.
getFieldValueback to summary
public String getFieldValue(PersonName.NameField nameField, Set<PersonName.FieldModifier> modifiers)

Implements com.ibm.icu.text.PersonName.getFieldValue.

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.

Parameters
nameField:PersonName.NameField

The identifier of the requested field.

modifiers:Set<PersonName.FieldModifier>

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:String

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.

Annotations
@Override
ICU Status
Draft since ICU 73.
getNameLocaleback to summary
public Locale getNameLocale()

Implements com.ibm.icu.text.PersonName.getNameLocale.

Returns the locale of the name-- that is, the language or country of origin for the person being named.

Returns:Locale

The name's locale, or null if it's unknown.

Annotations
@Override
ICU Status
Draft since ICU 73.
getPreferredOrderback to summary
public PersonName.PreferredOrder getPreferredOrder()

Implements com.ibm.icu.text.PersonName.getPreferredOrder.

Returns the preferred field order for the name. This will be DEFAULT, unless the caller sets it to something else using the builder.

Returns:PersonName.PreferredOrder

The name's preferred field order.

Annotations
@Override
ICU Status
Draft since ICU 73.
makeModifiedFieldNameback to summary
private static String makeModifiedFieldName(PersonName.NameField fieldName, Collection<PersonName.FieldModifier> modifiers)
makeModifiersFromNameback to summary
private static Set<PersonName.FieldModifier> makeModifiersFromName(String modifiedName)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Deprecated

This API is ICU internal only.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component: Debugging only!
com.ibm.icu.text back to summary

public Class SimplePersonName.Builder

extends Object
Class Inheritance

A utility class for constructing a SimplePersonName. Use SimplePersonName.builder() to get a new Builder instance.
ICU Status
Draft since ICU 73.

Field Summary

Modifier and TypeField and Description
private Map<String, String>
private Locale
private PersonName.PreferredOrder

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public SimplePersonName.Builder

Returns:

This builder.
addField
(PersonName.NameField
A NameField object specifying the field to set.
field
,
Collection<PersonName.FieldModifier>
A collection of FieldModifier objects for any modifiers that apply to this field value. May be null, which is the same as the empty set.
modifiers
,
String
The value for this field.
value
)

Sets the value for one field (with optional modifiers) in the new name object.

public SimplePersonName

Returns:

A SimplePersonName with the field values and name locale that were passed to this builder.
build
()

Returns a SimplePersonName with the field values and name locale that were passed to this builder.

public SimplePersonName.Builder

Returns:

This builder.
setLocale
(Locale
The locale for the new name object. Can be null, which indicates the name's locale is unknown.
locale
)

Set the locale for the new name object.

public SimplePersonName.Builder

Returns:

This builder.
setPreferredOrder
(PersonName.PreferredOrder
The preferred order for the new name object.
preferredOrder
)

Set the preferred order for the new name object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fieldValuesback to summary
private Map<String, String> fieldValues
localeback to summary
private Locale locale
preferredOrderback to summary
private PersonName.PreferredOrder preferredOrder

Constructor Detail

Builderback to summary
private Builder()

Method Detail

addFieldback to summary
public SimplePersonName.Builder addField(PersonName.NameField field, Collection<PersonName.FieldModifier> modifiers, String value)

Sets the value for one field (with optional modifiers) in the new name object.

Parameters
field:PersonName.NameField

A NameField object specifying the field to set.

modifiers:Collection<PersonName.FieldModifier>

A collection of FieldModifier objects for any modifiers that apply to this field value. May be null, which is the same as the empty set.

value:String

The value for this field.

Returns:SimplePersonName.Builder

This builder.

ICU Status
Draft since ICU 73.
buildback to summary
public SimplePersonName build()

Returns a SimplePersonName with the field values and name locale that were passed to this builder.

Returns:SimplePersonName

A SimplePersonName with the field values and name locale that were passed to this builder.

ICU Status
Draft since ICU 73.
setLocaleback to summary
public SimplePersonName.Builder setLocale(Locale locale)

Set the locale for the new name object.

Parameters
locale:Locale

The locale for the new name object. Can be null, which indicates the name's locale is unknown.

Returns:SimplePersonName.Builder

This builder.

ICU Status
Draft since ICU 73.
setPreferredOrderback to summary
public SimplePersonName.Builder setPreferredOrder(PersonName.PreferredOrder preferredOrder)

Set the preferred order for the new name object.

Parameters
preferredOrder:PersonName.PreferredOrder

The preferred order for the new name object.

Returns:SimplePersonName.Builder

This builder.

ICU Status
Draft since ICU 73.