mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 17:01:16 +00:00
ICU-22534 ICU4J 75 frontload: API status update
This commit is contained in:
parent
ceca6c4120
commit
09ccfb9956
5 changed files with 66 additions and 66 deletions
|
@ -13,7 +13,7 @@ import java.util.Set;
|
|||
* above. A concrete SimplePersonName object that does store the field values directly
|
||||
* is provided.
|
||||
*
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
* @see SimplePersonName
|
||||
*/
|
||||
public interface PersonName {
|
||||
|
@ -22,32 +22,32 @@ public interface PersonName {
|
|||
|
||||
/**
|
||||
* Identifiers for the name fields supported by the PersonName object.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
enum NameField {
|
||||
/**
|
||||
* Contains titles such as "Mr.", "Dr." (in English these typically
|
||||
* precede the name)
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
TITLE("title"),
|
||||
|
||||
/**
|
||||
* The given name. May contain more than one token.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
GIVEN("given"),
|
||||
|
||||
/**
|
||||
* Additional given names. (In English, this is usually the "middle name" and
|
||||
* may contain more than one word.)
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
GIVEN2("given2"),
|
||||
|
||||
/**
|
||||
* The surname. In Spanish, this is the patronymic surname.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
SURNAME("surname"),
|
||||
|
||||
|
@ -55,21 +55,21 @@ public interface PersonName {
|
|||
* 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.)
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
SURNAME2("surname2"),
|
||||
|
||||
/**
|
||||
* Generational qualifiers that in English generally follow the actual name,
|
||||
* such as "Jr." or "III".
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
GENERATION("generation"),
|
||||
|
||||
/**
|
||||
* Professional qualifiers that in English generally follow the actual name,
|
||||
* such as "M.D." or "J.D.".
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
CREDENTIALS("credentials");
|
||||
|
||||
|
@ -81,7 +81,7 @@ public interface PersonName {
|
|||
|
||||
/**
|
||||
* Returns the NameField's display name.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -106,7 +106,7 @@ public interface PersonName {
|
|||
|
||||
/**
|
||||
* Identifiers for the name field modifiers supported by the PersonName and PersonNameFormatter objects.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
enum FieldModifier {
|
||||
/**
|
||||
|
@ -114,7 +114,7 @@ public interface PersonName {
|
|||
* 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".
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
INFORMAL("informal"),
|
||||
|
||||
|
@ -123,7 +123,7 @@ public interface PersonName {
|
|||
* "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.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
PREFIX("prefix"),
|
||||
|
||||
|
@ -132,7 +132,7 @@ public interface PersonName {
|
|||
* "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".
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
CORE("core"),
|
||||
|
||||
|
@ -140,7 +140,7 @@ public interface PersonName {
|
|||
* 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).
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
INITIAL("initial"),
|
||||
|
||||
|
@ -149,14 +149,14 @@ public interface PersonName {
|
|||
* (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.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
MONOGRAM("monogram"),
|
||||
|
||||
/**
|
||||
* Requests the field value converted to ALL CAPS. PersonName objects
|
||||
* generally won't need to handle this modifier themselves.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
ALL_CAPS("allCaps"),
|
||||
|
||||
|
@ -174,7 +174,7 @@ public interface PersonName {
|
|||
* 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.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
INITIAL_CAP("initialCap"),
|
||||
|
||||
|
@ -202,7 +202,7 @@ public interface PersonName {
|
|||
|
||||
/**
|
||||
* Returns the FieldModifier's display name.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -211,7 +211,7 @@ public interface PersonName {
|
|||
|
||||
/**
|
||||
* Returns the appropriate fieldModifier for its display name.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public static FieldModifier forString(String name) {
|
||||
for (FieldModifier modifier : values()) {
|
||||
|
@ -225,27 +225,27 @@ public interface PersonName {
|
|||
|
||||
/**
|
||||
* An enum to specify the preferred field order for the name.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
enum PreferredOrder {
|
||||
/**
|
||||
* 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.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
DEFAULT,
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
GIVEN_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.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
SURNAME_FIRST
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public interface PersonName {
|
|||
* An implementing class is allowed to return null here to indicate the name's locale is unknown.
|
||||
*
|
||||
* @return The name's locale, or null if it's not known.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Locale getNameLocale();
|
||||
|
||||
|
@ -267,7 +267,7 @@ public interface PersonName {
|
|||
* 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.
|
||||
* @return The name's preferred field order.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public PreferredOrder getPreferredOrder();
|
||||
|
||||
|
@ -281,7 +281,7 @@ public interface PersonName {
|
|||
* DIDN'T handle. This parameter may not be null, and must either be mutable or empty.
|
||||
* @return 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.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public String getFieldValue(NameField identifier, Set<FieldModifier> modifiers);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ import com.ibm.icu.impl.personname.PersonNameFormatterImpl;
|
|||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public class PersonNameFormatter {
|
||||
//==============================================================================
|
||||
|
@ -71,26 +71,26 @@ public class PersonNameFormatter {
|
|||
|
||||
/**
|
||||
* Specifies the desired length of the formatted name.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public enum Length {
|
||||
/**
|
||||
* The longest name length. Generally uses most of the fields in the name object.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
LONG,
|
||||
|
||||
/**
|
||||
* The most typical name length. Generally includes the given name and surname, but generally
|
||||
* not most of the other fields.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
MEDIUM,
|
||||
|
||||
/**
|
||||
* A shortened name. Skips most fields and may abbreviate some name fields to just their initials.
|
||||
* When Formality is INFORMAL, may only include one field.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
SHORT,
|
||||
|
||||
|
@ -103,18 +103,18 @@ public class PersonNameFormatter {
|
|||
|
||||
/**
|
||||
* Specifies the intended usage of the formatted name.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public enum Usage {
|
||||
/**
|
||||
* Used for when the name is going to be used to address the user directly: "Turn left here, John."
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
ADDRESSING,
|
||||
|
||||
/**
|
||||
* Used in general cases, when the name is used to refer to somebody else.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
REFERRING,
|
||||
|
||||
|
@ -123,26 +123,26 @@ public class PersonNameFormatter {
|
|||
* like chat avatars. In English, this is usually the person's initials, but this isn't true in all
|
||||
* languages. When the caller specifies Usage.MONOGRAM, the Length parameter can be used to get different
|
||||
* lengths of monograms: Length.SHORT is generally a single letter; Length.LONG may be as many as three or four.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
MONOGRAM
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the intended formality of the formatted name.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public enum Formality {
|
||||
/**
|
||||
* The more formal version of the name.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
FORMAL,
|
||||
|
||||
/**
|
||||
* The more informal version of the name. In English, this might omit fields or use the "informal" variant
|
||||
* of the given name.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
INFORMAL,
|
||||
|
||||
|
@ -156,12 +156,12 @@ public class PersonNameFormatter {
|
|||
|
||||
/**
|
||||
* An enum indicating the desired display order for a formatted name.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public enum DisplayOrder {
|
||||
/**
|
||||
* The default display order; used to indicate normal formatting.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
DEFAULT,
|
||||
|
||||
|
@ -169,7 +169,7 @@ public class PersonNameFormatter {
|
|||
* Used to indicate a display order suitable for use in a sorted list:
|
||||
* For English, this would put the surnames first, with a comma between them and the rest
|
||||
* of the name: "Smith, John".
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
SORTING,
|
||||
|
||||
|
@ -196,14 +196,14 @@ public class PersonNameFormatter {
|
|||
/**
|
||||
* A utility class that can be used to construct a PersonNameFormatter.
|
||||
* Use PersonNameFormatter.builder() to get a new instance.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public static class Builder {
|
||||
/**
|
||||
* Sets the locale for the formatter to be constructed.
|
||||
* @param locale The new formatter locale. May not be null.
|
||||
* @return This builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Builder setLocale(Locale locale) {
|
||||
if (locale != null) {
|
||||
|
@ -216,7 +216,7 @@ public class PersonNameFormatter {
|
|||
* Sets the name length for the formatter to be constructed.
|
||||
* @param length The new name length.
|
||||
* @return This builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Builder setLength(Length length) {
|
||||
this.length = length;
|
||||
|
@ -227,7 +227,7 @@ public class PersonNameFormatter {
|
|||
* Sets the name usage for the formatter to be constructed.
|
||||
* @param usage The new name length.
|
||||
* @return This builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Builder setUsage(Usage usage) {
|
||||
this.usage = usage;
|
||||
|
@ -238,7 +238,7 @@ public class PersonNameFormatter {
|
|||
* Sets the name formality for the formatter to be constructed.
|
||||
* @param formality The new name length.
|
||||
* @return This builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Builder setFormality(Formality formality) {
|
||||
this.formality = formality;
|
||||
|
@ -252,7 +252,7 @@ public class PersonNameFormatter {
|
|||
* for most contexts (e.g., in English, "John Smith").
|
||||
* @param order The desired display order for formatted names.
|
||||
* @return This builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Builder setDisplayOrder(DisplayOrder order) {
|
||||
this.displayOrder = order;
|
||||
|
@ -264,7 +264,7 @@ public class PersonNameFormatter {
|
|||
* Japanese names to highlight which name is the surname.
|
||||
* @param allCaps If true, the surname in the formatted result will be rendered in ALL CAPS.
|
||||
* @return This builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Builder setSurnameAllCaps(boolean allCaps) {
|
||||
this.surnameAllCaps = allCaps;
|
||||
|
@ -277,7 +277,7 @@ public class PersonNameFormatter {
|
|||
* (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.
|
||||
* @return A new PersonNameFormatter.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public PersonNameFormatter build() {
|
||||
return new PersonNameFormatter(locale, length, usage, formality, displayOrder, surnameAllCaps);
|
||||
|
@ -300,7 +300,7 @@ public class PersonNameFormatter {
|
|||
/**
|
||||
* Returns a Builder object that can be used to construct a new PersonNameFormatter.
|
||||
* @return A new Builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
|
@ -310,7 +310,7 @@ public class PersonNameFormatter {
|
|||
* Returns a Builder object whose fields match those used to construct this formatter,
|
||||
* allowing a new formatter to be created based on this one.
|
||||
* @return A new Builder that can be used to create a new formatter based on this formatter.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Builder toBuilder() {
|
||||
Builder builder = builder();
|
||||
|
@ -328,7 +328,7 @@ public class PersonNameFormatter {
|
|||
* @param name A PersonName object that supplies individual field values (optionally, with modifiers applied)
|
||||
* to the formatter for formatting.
|
||||
* @return The name, formatted according to the locale and other parameters passed to the formatter's constructor.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public String formatToString(PersonName name) {
|
||||
// TODO: Add a format() method that returns a FormattedPersonName object that descends from FormattedValue.
|
||||
|
|
|
@ -18,13 +18,13 @@ import java.util.TreeSet;
|
|||
* 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.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public class SimplePersonName implements PersonName {
|
||||
/**
|
||||
* A utility class for constructing a SimplePersonName. Use SimplePersonName.builder()
|
||||
* to get a new Builder instance.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public static class Builder {
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ public class SimplePersonName implements PersonName {
|
|||
* @param locale The locale for the new name object. Can be null, which indicates the
|
||||
* name's locale is unknown.
|
||||
* @return This builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Builder setLocale(Locale locale) {
|
||||
this.locale = locale;
|
||||
|
@ -43,7 +43,7 @@ public class SimplePersonName implements PersonName {
|
|||
* Set the preferred order for the new name object.
|
||||
* @param preferredOrder The preferred order for the new name object.
|
||||
* @return This builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Builder setPreferredOrder(PreferredOrder preferredOrder) {
|
||||
this.preferredOrder = preferredOrder;
|
||||
|
@ -57,7 +57,7 @@ public class SimplePersonName implements PersonName {
|
|||
* to this field value. May be null, which is the same as the empty set.
|
||||
* @param value The value for this field.
|
||||
* @return This builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public Builder addField(NameField field,
|
||||
Collection<FieldModifier> modifiers,
|
||||
|
@ -86,7 +86,7 @@ public class SimplePersonName implements PersonName {
|
|||
/**
|
||||
* Returns a SimplePersonName with the field values and name locale that were passed to this builder.
|
||||
* @return A SimplePersonName with the field values and name locale that were passed to this builder.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public SimplePersonName build() {
|
||||
// special-case code for the "surname" field -- if it isn't specified, but "surname-prefix" and
|
||||
|
@ -122,7 +122,7 @@ public class SimplePersonName implements PersonName {
|
|||
/**
|
||||
* Returns a Builder object that can be used to construct a new SimplePersonName object.
|
||||
* @return A Builder object that can be used to construct a new SimplePersonName object.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
|
@ -140,7 +140,7 @@ public class SimplePersonName implements PersonName {
|
|||
/**
|
||||
* Returns the locale of the name-- that is, the language or country of origin for the person being named.
|
||||
* @return The name's locale, or null if it's unknown.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
@Override
|
||||
public Locale getNameLocale() {
|
||||
|
@ -151,7 +151,7 @@ public class SimplePersonName implements PersonName {
|
|||
* Returns the preferred field order for the name. This will be DEFAULT, unless the caller sets it to something
|
||||
* else using the builder.
|
||||
* @return The name's preferred field order.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
@Override
|
||||
public PreferredOrder getPreferredOrder() { return preferredOrder; }
|
||||
|
@ -167,7 +167,7 @@ public class SimplePersonName implements PersonName {
|
|||
* was provided at construction time.
|
||||
* @return 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.
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
@Override
|
||||
public String getFieldValue(NameField nameField, Set<FieldModifier> modifiers) {
|
||||
|
@ -254,4 +254,4 @@ public class SimplePersonName implements PersonName {
|
|||
private final Locale nameLocale;
|
||||
private final PreferredOrder preferredOrder;
|
||||
private final Map<String, String> fieldValues;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3939,7 +3939,7 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
|
|||
* constructors, applyPattern(), and closeOver().
|
||||
* It can be ORed together with other, unrelated options.
|
||||
*
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public static final int SIMPLE_CASE_INSENSITIVE = 6;
|
||||
|
||||
|
|
|
@ -1799,7 +1799,7 @@ public class MeasureUnit implements Serializable {
|
|||
|
||||
/**
|
||||
* Constant for unit of speed: beaufort
|
||||
* @draft ICU 73
|
||||
* @stable ICU 73
|
||||
*/
|
||||
public static final MeasureUnit BEAUFORT = MeasureUnit.internalGetInstance("speed", "beaufort");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue