Top Description Inners Methods
com.ibm.icu.text

public Interface PersonName

Known Direct Implementers
com.ibm.icu.impl.personname.PersonNamePattern.GivenToSurnamePersonName, com.ibm.icu.text.SimplePersonName
Imports
java.util.Locale, .Set

An object used to provide name data to the PersonNameFormatter for formatting. Clients can implement this interface to talk directly to some other subsystem that actually contains the name data (instead of having to copy it into a separate object just for formatting) or to override the default modifier behavior described above. A concrete SimplePersonName object that does store the field values directly is provided.
ICU Status
Draft since ICU 73.
See Also
SimplePersonName

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
PersonName.FieldModifier

Identifiers for the name field modifiers supported by the PersonName and PersonNameFormatter objects.

public static enum
PersonName.NameField

Identifiers for the name fields supported by the PersonName object.

public static enum
PersonName.PreferredOrder

An enum to specify the preferred field order for the name.

Method Summary

Modifier and TypeMethod and Description
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.
identifier
,
Set<PersonName.FieldModifier>
An IN/OUT parameter that specifies modifiers to apply to the basic field value. An implementing class can choose to handle or ignore any modifiers; it should modify the passed-in Set so that on exit, it contains only the requested modifiers that it DIDN'T handle. This parameter may not be null, and must either be mutable or empty.
modifiers
)

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

public Locale

Returns:

The name's locale, or null if it's not known.
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
()

Returns the preferred field order for the name.

Method Detail

getFieldValueback to summary
public String getFieldValue(PersonName.NameField identifier, Set<PersonName.FieldModifier> modifiers)

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

Parameters
identifier: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. An implementing class can choose to handle or ignore any modifiers; it should modify the passed-in Set so that on exit, it contains only the requested modifiers that it DIDN'T handle. This parameter may not be null, and must either be mutable or empty.

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.

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

Returns the locale of the name-- that is, the language or country of origin for the person being named. An implementing class is allowed to return null here to indicate the name's locale is unknown.

Returns:Locale

The name's locale, or null if it's not known.

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

Returns the preferred field order for the name. PersonName objects should generally return DEFAULT, allowing the PersonNameFormatter to deduce the peoper field order based on the locales of the name and the formatter. But this can be used to force a particular field order, generally in cases where the deduction logic in PersonNameFormatter would guess wrong.

Returns:PersonName.PreferredOrder

The name's preferred field order.

ICU Status
Draft since ICU 73.
com.ibm.icu.text back to summary

public final Enum PersonName.FieldModifier

extends Enum<PersonName.FieldModifier>
Class Inheritance

Identifiers for the name field modifiers supported by the PersonName and PersonNameFormatter objects.
ICU Status
Draft since ICU 73.

Field Summary

Modifier and TypeField and Description
public static final PersonName.FieldModifier
ALL_CAPS

Requests the field value converted to ALL CAPS.

public static final PersonName.FieldModifier
CORE

If the field contains a main word with one or more separate prefixes, such as "van den Hul", this requests just the main word ("Hul").

public static final PersonName.FieldModifier
GENITIVE

Requests the genitive form of the field's contents, if possible.

public static final PersonName.FieldModifier
INFORMAL

Requests an "informal" variant of the field, generally a nickname of some type: if "given" is "James", "given-informal" might be "Jimmy".

public static final PersonName.FieldModifier
INITIAL

Requests an initial for the specified field.

public static final PersonName.FieldModifier
INITIAL_CAP

Requests the field value with the first grapheme of each word converted to titlecase.

public static final PersonName.FieldModifier
MONOGRAM

Requests an initial for the specified field, suitable for use in a monogram (this usually differs from "initial" in that "initial" often adds a period and "monogram" never does).

private final String
public static final PersonName.FieldModifier
PREFIX

If the field contains a main word with one or more separate prefixes, such as "van den Hul", this requests just the prefixes ("van den").

public static final PersonName.FieldModifier
RETAIN

When used in conjunction with "initial", preserves the punctuation between the initials as it existed in the original name field (e.g., "Jean-Claude" initializes into "J-C" instead of "J.C.") Has no effect if "initial" isn't also present in the list of modifiers.

public static final PersonName.FieldModifier
VOCATIVE

Requests the vocative form of the field's contents, if possible.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static PersonName.FieldModifier
forString(String name)

Returns the appropriate fieldModifier for its display name.

public String
toString()

Overrides java.lang.Enum.toString.

Returns the FieldModifier's display name.
public static PersonName.FieldModifier
public static PersonName.FieldModifier[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinalvalueOf

Field Detail

ALL_CAPSback to summary
public static final PersonName.FieldModifier ALL_CAPS

Requests the field value converted to ALL CAPS. PersonName objects generally won't need to handle this modifier themselves.

ICU Status
Draft since ICU 73.
COREback to summary
public static final PersonName.FieldModifier CORE

If the field contains a main word with one or more separate prefixes, such as "van den Hul", this requests just the main word ("Hul"). Only applied to the "surname" field. If the implementing class doesn't apply this modifier, PersonNameFormatter assumes the entire "surname" field is the "core".

ICU Status
Draft since ICU 73.
GENITIVEback to summary
public static final PersonName.FieldModifier GENITIVE

Requests the genitive form of the field's contents, if possible. The default implementation does nothing, but subclasses of PersonName can override getFieldValue() to produce the genitive form (or just add an "xxx-genitive" entry to a SimplePersonName).

ICU Status
Draft since ICU 74.
INFORMALback to summary
public static final PersonName.FieldModifier INFORMAL

Requests an "informal" variant of the field, generally a nickname of some type: if "given" is "James", "given-informal" might be "Jimmy". Only applied to the "given" field. If the PersonName object doesn't apply this modifier, PersonNameFormatter just uses the unmodified version of "given".

ICU Status
Draft since ICU 73.
INITIALback to summary
public static final PersonName.FieldModifier INITIAL

Requests an initial for the specified field. PersonNameFormatter will do this algorithmically, but a PersonName object can apply this modifier itself if it wants different initial-generation logic (or stores the initial separately).

ICU Status
Draft since ICU 73.
INITIAL_CAPback to summary
public static final PersonName.FieldModifier INITIAL_CAP

Requests the field value with the first grapheme of each word converted to titlecase. A PersonName object might handle this modifier itself to capitalize words more selectively.

ICU Status
Draft since ICU 73.
MONOGRAMback to summary
public static final PersonName.FieldModifier MONOGRAM

Requests an initial for the specified field, suitable for use in a monogram (this usually differs from "initial" in that "initial" often adds a period and "monogram" never does). PersonNameFormatter will do this algorithmically, but a PersonName object can apply this modifier itself if it wants different monogram-generation logic.

ICU Status
Draft since ICU 73.
nameback to summary
private final String name

Hides java.lang.Enum.name.

PREFIXback to summary
public static final PersonName.FieldModifier PREFIX

If the field contains a main word with one or more separate prefixes, such as "van den Hul", this requests just the prefixes ("van den"). Only applied to the "surname" field. If the PersonName object doesn't apply this modifier, PersonNameFormatter assumes there are no prefixes.

ICU Status
Draft since ICU 73.
RETAINback to summary
public static final PersonName.FieldModifier RETAIN

Deprecated

This API is ICU internal only.

When used in conjunction with "initial", preserves the punctuation between the initials as it existed in the original name field (e.g., "Jean-Claude" initializes into "J-C" instead of "J.C.") Has no effect if "initial" isn't also present in the list of modifiers.

Annotations
@Deprecated
ICU Status
Internal ICU component.
VOCATIVEback to summary
public static final PersonName.FieldModifier VOCATIVE

Requests the vocative form of the field's contents, if possible. The default implementation does nothing, but subclasses of PersonName can override getFieldValue() to produce the vocative form (or just add an "xxx-vocative" entry to a SimplePersonName).

ICU Status
Draft since ICU 74.

Constructor Detail

FieldModifierback to summary
private FieldModifier(String name)

Method Detail

forStringback to summary
public static PersonName.FieldModifier forString(String name)

Returns the appropriate fieldModifier for its display name.

ICU Status
Draft since ICU 73.
toStringback to summary
public String toString()

Overrides java.lang.Enum.toString.

Returns the FieldModifier's display name.

Returns:String

Doc from java.lang.Enum.toString.

the name of this enum constant

Annotations
@Override
ICU Status
Draft since ICU 73.
valueOfback to summary
public static PersonName.FieldModifier valueOf(String name)
valuesback to summary
public static PersonName.FieldModifier[] values()
com.ibm.icu.text back to summary

public final Enum PersonName.NameField

extends Enum<PersonName.NameField>
Class Inheritance

Identifiers for the name fields supported by the PersonName object.
ICU Status
Draft since ICU 73.

Field Summary

Modifier and TypeField and Description
public static final PersonName.NameField
CREDENTIALS

Professional qualifiers that in English generally follow the actual name, such as "M.D." or "J.D.".

public static final PersonName.NameField
GENERATION

Generational qualifiers that in English generally follow the actual name, such as "Jr." or "III".

public static final PersonName.NameField
GIVEN

The given name.

public static final PersonName.NameField
GIVEN2

Additional given names.

private final String
public static final PersonName.NameField
SURNAME

The surname.

public static final PersonName.NameField
SURNAME2

Additional surnames.

public static final PersonName.NameField
TITLE

Contains titles such as "Mr.", "Dr." (in English these typically precede the name)

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static PersonName.NameField
forString(String name)

Deprecated This API is for ICU internal use only.
Returns the appropriate NameField for its display name.
public String
toString()

Overrides java.lang.Enum.toString.

Returns the NameField's display name.
public static PersonName.NameField
public static PersonName.NameField[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinalvalueOf

Field Detail

CREDENTIALSback to summary
public static final PersonName.NameField CREDENTIALS

Professional qualifiers that in English generally follow the actual name, such as "M.D." or "J.D.".

ICU Status
Draft since ICU 73.
GENERATIONback to summary
public static final PersonName.NameField GENERATION

Generational qualifiers that in English generally follow the actual name, such as "Jr." or "III".

ICU Status
Draft since ICU 73.
GIVENback to summary
public static final PersonName.NameField GIVEN

The given name. May contain more than one token.

ICU Status
Draft since ICU 73.
GIVEN2back to summary
public static final PersonName.NameField GIVEN2

Additional given names. (In English, this is usually the "middle name" and may contain more than one word.)

ICU Status
Draft since ICU 73.
nameback to summary
private final String name

Hides java.lang.Enum.name.

SURNAMEback to summary
public static final PersonName.NameField SURNAME

The surname. In Spanish, this is the patronymic surname.

ICU Status
Draft since ICU 73.
SURNAME2back to summary
public static final PersonName.NameField SURNAME2

Additional surnames. This is only used in a few languages, such as Spanish, where it is the matronymic surname. (In most languages, multiple surnames all just go in the SURNAME field.)

ICU Status
Draft since ICU 73.
TITLEback to summary
public static final PersonName.NameField TITLE

Contains titles such as "Mr.", "Dr." (in English these typically precede the name)

ICU Status
Draft since ICU 73.

Constructor Detail

NameFieldback to summary
private NameField(String name)

Method Detail

forStringback to summary
public static PersonName.NameField forString(String name)

Deprecated

This API is for ICU internal use only.

Returns the appropriate NameField for its display name.

Annotations
@Deprecated
ICU Status
Internal ICU component.
toStringback to summary
public String toString()

Overrides java.lang.Enum.toString.

Returns the NameField's display name.

Returns:String

Doc from java.lang.Enum.toString.

the name of this enum constant

Annotations
@Override
ICU Status
Draft since ICU 73.
valueOfback to summary
public static PersonName.NameField valueOf(String name)
valuesback to summary
public static PersonName.NameField[] values()
com.ibm.icu.text back to summary

public final Enum PersonName.PreferredOrder

extends Enum<PersonName.PreferredOrder>
Class Inheritance

An enum to specify the preferred field order for the name.
ICU Status
Draft since ICU 73.

Field Summary

Modifier and TypeField and Description
public static final PersonName.PreferredOrder
DEFAULT

Indicates the name has no preferred field order, and that the formatter should deduce the proper field order based on the locales of the name and the formatter.

public static final PersonName.PreferredOrder
GIVEN_FIRST

Indicates that the name should be formatted in given-first order, even when the formatter would normally guess that it should be formatted in surname-first order.

public static final PersonName.PreferredOrder
SURNAME_FIRST

Indicates that the name should be formatted in surname-first order, even when the formatter would normally guess that it should be formatted in given-first order.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static PersonName.PreferredOrder
public static PersonName.PreferredOrder[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DEFAULTback to summary
public static final PersonName.PreferredOrder DEFAULT

Indicates the name has no preferred field order, and that the formatter should deduce the proper field order based on the locales of the name and the formatter.

ICU Status
Draft since ICU 73.
GIVEN_FIRSTback to summary
public static final PersonName.PreferredOrder GIVEN_FIRST

Indicates that the name should be formatted in given-first order, even when the formatter would normally guess that it should be formatted in surname-first order.

ICU Status
Draft since ICU 73.
SURNAME_FIRSTback to summary
public static final PersonName.PreferredOrder SURNAME_FIRST

Indicates that the name should be formatted in surname-first order, even when the formatter would normally guess that it should be formatted in given-first order.

ICU Status
Draft since ICU 73.

Constructor Detail

PreferredOrderback to summary
private PreferredOrder()

Method Detail

valueOfback to summary
public static PersonName.PreferredOrder valueOf(String name)
valuesback to summary
public static PersonName.PreferredOrder[] values()