Top Description Inners Fields Constructors Methods
com.ibm.icu.impl.personname

pack-priv Class PersonNamePattern

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .HashMap, .HashSet, .List, .Locale, .Map, .Set, .StringTokenizer, com.ibm.icu.text.PersonName

A single name formatting pattern, corresponding to a single namePattern element in CLDR.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
PersonNamePattern.Element

A single element in a NamePattern.

private static class
PersonNamePattern.GivenToSurnamePersonName

Internal class used when formatting a mononym (a PersonName object that only has a given-name field).

private static class
PersonNamePattern.LiteralText

Literal text from a name pattern.

private static class
PersonNamePattern.NameFieldImpl

An actual name field in a NamePattern (i.e., the stuff represented in the pattern by text in braces).

Field Summary

Modifier and TypeField and Description
private PersonNamePattern.Element[]
private String

Constructor Summary

AccessConstructor and Description
private
PersonNamePattern(String patternText, PersonNameFormatterImpl formatterImpl)

Method Summary

Modifier and TypeMethod and Description
private String
coalesce(StringBuilder
The literal text before the omitted field.
s1
,
StringBuilder
The literal text after the omitted field.
s2
)

Stitches together the literal text on either side of an omitted field by deleting any non-whitespace characters immediately neighboring the omitted field and coalescing any adjacent spaces at the join point down to one.

private boolean
endsWith(StringBuilder s1, StringBuilder s2)

Returns true if s1 ends with s2.

public String
private PersonName
public static PersonNamePattern[]
makePatterns(String[] patternText, PersonNameFormatterImpl formatterImpl)

public int
public int
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

patternElementsback to summary
private PersonNamePattern.Element[] patternElements
patternTextback to summary
private String patternText

Constructor Detail

PersonNamePatternback to summary
private PersonNamePattern(String patternText, PersonNameFormatterImpl formatterImpl)

Method Detail

coalesceback to summary
private String coalesce(StringBuilder s1, StringBuilder s2)

Stitches together the literal text on either side of an omitted field by deleting any non-whitespace characters immediately neighboring the omitted field and coalescing any adjacent spaces at the join point down to one.

Parameters
s1:StringBuilder

The literal text before the omitted field.

s2:StringBuilder

The literal text after the omitted field.

endsWithback to summary
private boolean endsWith(StringBuilder s1, StringBuilder s2)

Returns true if s1 ends with s2.

formatback to summary
public String format(PersonName name)
hackNameForEmptyFieldsback to summary
private PersonName hackNameForEmptyFields(PersonName originalName)
makePatternsback to summary
public static PersonNamePattern[] makePatterns(String[] patternText, PersonNameFormatterImpl formatterImpl)
numEmptyFieldsback to summary
public int numEmptyFields(PersonName name)
numPopulatedFieldsback to summary
public int numPopulatedFields(PersonName name)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
com.ibm.icu.impl.personname back to summary

private Interface PersonNamePattern.Element

Known Direct Implementers
com.ibm.icu.impl.personname.PersonNamePattern.LiteralText, com.ibm.icu.impl.personname.PersonNamePattern.NameFieldImpl

A single element in a NamePattern. This is either a name field or a range of literal text.

Method Summary

Modifier and TypeMethod and Description
public String
public boolean
public boolean

Method Detail

formatback to summary
public String format(PersonName name)
isLiteralback to summary
public boolean isLiteral()
isPopulatedback to summary
public boolean isPopulated(PersonName name)
com.ibm.icu.impl.personname back to summary

private Class PersonNamePattern.GivenToSurnamePersonName

extends Object
implements PersonName
Class Inheritance
  • java.lang.Object
  • com.ibm.icu.impl.personname.PersonNamePattern.GivenToSurnamePersonName
All Implemented Interfaces
com.ibm.icu.text.PersonName

Internal class used when formatting a mononym (a PersonName object that only has a given-name field). If the name doesn't have a surname field and the pattern doesn't have a given-name field (or only has one that produces an initial), we use this class to behave as though the value supplied in the given-name field had instead been supplied in the surname field.

Field Summary

Modifier and TypeField and Description
private PersonName

Constructor Summary

AccessConstructor and Description
public
GivenToSurnamePersonName(PersonName underlyingPersonName)

Method Summary

Modifier and TypeMethod and Description
public String
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
)

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

Returns one field of the name, possibly in a modified form.
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.
public PersonName.PreferredOrder
getPreferredOrder()

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

Returns the preferred field order for the name.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

underlyingPersonNameback to summary
private PersonName underlyingPersonName

Constructor Detail

GivenToSurnamePersonNameback to summary
public GivenToSurnamePersonName(PersonName underlyingPersonName)

Method Detail

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

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

Doc from com.ibm.icu.text.PersonName.getFieldValue.

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.

Annotations
@Override
getNameLocaleback to summary
public Locale getNameLocale()

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

Doc from 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. 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.

Annotations
@Override
getPreferredOrderback to summary
public PersonName.PreferredOrder getPreferredOrder()

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

Doc from com.ibm.icu.text.PersonName.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.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
com.ibm.icu.impl.personname back to summary

private Class PersonNamePattern.LiteralText

extends Object
implements Element
Class Inheritance
All Implemented Interfaces
com.ibm.icu.impl.personname.PersonNamePattern.Element

Literal text from a name pattern.

Field Summary

Modifier and TypeField and Description
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
public boolean
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

textback to summary
private String text

Constructor Detail

LiteralTextback to summary
public LiteralText(String text)

Method Detail

formatback to summary
public String format(PersonName name)

Implements com.ibm.icu.impl.personname.PersonNamePattern.Element.format.

isLiteralback to summary
public boolean isLiteral()

Implements com.ibm.icu.impl.personname.PersonNamePattern.Element.isLiteral.

isPopulatedback to summary
public boolean isPopulated(PersonName name)

Implements com.ibm.icu.impl.personname.PersonNamePattern.Element.isPopulated.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
com.ibm.icu.impl.personname back to summary

private Class PersonNamePattern.NameFieldImpl

extends Object
implements Element
Class Inheritance
All Implemented Interfaces
com.ibm.icu.impl.personname.PersonNamePattern.Element

An actual name field in a NamePattern (i.e., the stuff represented in the pattern by text in braces). This class actually handles fetching the value for the field out of a PersonName object and applying any modifiers to it.

Field Summary

Modifier and TypeField and Description
private PersonName.NameField
private Map<PersonName.FieldModifier, FieldModifierImpl>

Constructor Summary

AccessConstructor and Description
public
NameFieldImpl(String fieldNameAndModifiers, PersonNameFormatterImpl formatterImpl)

Method Summary

Modifier and TypeMethod and Description
public String
public boolean
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

fieldIDback to summary
private PersonName.NameField fieldID
modifiersback to summary
private Map<PersonName.FieldModifier, FieldModifierImpl> modifiers

Constructor Detail

NameFieldImplback to summary
public NameFieldImpl(String fieldNameAndModifiers, PersonNameFormatterImpl formatterImpl)

Method Detail

formatback to summary
public String format(PersonName name)

Implements com.ibm.icu.impl.personname.PersonNamePattern.Element.format.

isLiteralback to summary
public boolean isLiteral()

Implements com.ibm.icu.impl.personname.PersonNamePattern.Element.isLiteral.

isPopulatedback to summary
public boolean isPopulated(PersonName name)

Implements com.ibm.icu.impl.personname.PersonNamePattern.Element.isPopulated.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override