/* GENERATED SOURCE. DO NOT MODIFY. */ // © 2022 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html package android.icu.text; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * Represents all the display options that are supported by CLDR such as grammatical case, noun * class, ... etc. It currently supports enums, but may be extended in the future to have other * types of data. It replaces a DisplayContext[] as a method parameter. *
* NOTE: This class is Immutable, and uses a Builder interface. *
For example:
* {@code DisplayOptions x =
* DisplayOptions.builder()
* .setNounClass(NounClass.DATIVE)
* .setPluralCategory(PluralCategory.FEW)
* .build();
* }
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public final class DisplayOptions {
private final GrammaticalCase grammaticalCase;
private final NounClass nounClass;
private final PluralCategory pluralCategory;
private final Capitalization capitalization;
private final NameStyle nameStyle;
private final DisplayLength displayLength;
private final SubstituteHandling substituteHandling;
private DisplayOptions(Builder builder) {
this.grammaticalCase = builder.grammaticalCase;
this.nounClass = builder.nounClass;
this.pluralCategory = builder.pluralCategory;
this.capitalization = builder.capitalization;
this.nameStyle = builder.nameStyle;
this.displayLength = builder.displayLength;
this.substituteHandling = builder.substituteHandling;
}
/**
* Creates a builder with the {@code UNDEFINED} value for all the parameters.
*
* @return Builder
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public static Builder builder() {
return new Builder();
}
/**
* Creates a builder with the same parameters from this object.
*
* @return Builder
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public Builder copyToBuilder() {
return new Builder(this);
}
/**
* Gets the grammatical case.
*
* @return GrammaticalCase
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public GrammaticalCase getGrammaticalCase() {
return this.grammaticalCase;
}
/**
* Gets the noun class.
*
* @return NounClass
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public NounClass getNounClass() {
return this.nounClass;
}
/**
* Gets the plural category.
*
* @return PluralCategory
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public PluralCategory getPluralCategory() {
return this.pluralCategory;
}
/**
* Gets the capitalization.
*
* @return Capitalization
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public Capitalization getCapitalization() {
return this.capitalization;
}
/**
* Gets the name style.
*
* @return NameStyle
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public NameStyle getNameStyle() {
return this.nameStyle;
}
/**
* Gets the display length.
*
* @return DisplayLength
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public DisplayLength getDisplayLength() {
return this.displayLength;
}
/**
* Gets the substitute handling.
*
* @return SubstituteHandling
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public SubstituteHandling getSubstituteHandling() {
return this.substituteHandling;
}
/**
* Responsible for building {@code DisplayOptions}.
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public static class Builder {
private GrammaticalCase grammaticalCase;
private NounClass nounClass;
private PluralCategory pluralCategory;
private Capitalization capitalization;
private NameStyle nameStyle;
private DisplayLength displayLength;
private SubstituteHandling substituteHandling;
/**
* Creates a {@code DisplayOptions.Builder} with the default values.
*/
private Builder() {
this.grammaticalCase = GrammaticalCase.UNDEFINED;
this.nounClass = NounClass.UNDEFINED;
this.pluralCategory = PluralCategory.UNDEFINED;
this.capitalization = Capitalization.UNDEFINED;
this.nameStyle = NameStyle.UNDEFINED;
this.displayLength = DisplayLength.UNDEFINED;
this.substituteHandling = SubstituteHandling.UNDEFINED;
}
/**
* Creates a {@code Builder} with all the information from a {@code DisplayOptions}.
*
* @param displayOptions Options to be copied.
*/
private Builder(DisplayOptions displayOptions) {
this.grammaticalCase = displayOptions.grammaticalCase;
this.nounClass = displayOptions.nounClass;
this.pluralCategory = displayOptions.pluralCategory;
this.capitalization = displayOptions.capitalization;
this.nameStyle = displayOptions.nameStyle;
this.displayLength = displayOptions.displayLength;
this.substituteHandling = displayOptions.substituteHandling;
}
/**
* Sets the grammatical case.
*
* @param grammaticalCase The grammatical case.
* @return Builder
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public Builder setGrammaticalCase(GrammaticalCase grammaticalCase) {
this.grammaticalCase = grammaticalCase;
return this;
}
/**
* Sets the noun class.
*
* @param nounClass The noun class.
* @return Builder
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public Builder setNounClass(NounClass nounClass) {
this.nounClass = nounClass;
return this;
}
/**
* Sets the plural category.
*
* @param pluralCategory The plural category.
* @return Builder
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public Builder setPluralCategory(PluralCategory pluralCategory) {
this.pluralCategory = pluralCategory;
return this;
}
/**
* Sets the capitalization.
*
* @param capitalization The capitalization.
* @return Builder
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public Builder setCapitalization(Capitalization capitalization) {
this.capitalization = capitalization;
return this;
}
/**
* Sets the name style.
*
* @param nameStyle The name style.
* @return Builder
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public Builder setNameStyle(NameStyle nameStyle) {
this.nameStyle = nameStyle;
return this;
}
/**
* Sets the display length.
*
* @param displayLength The display length.
* @return Builder
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public Builder setDisplayLength(DisplayLength displayLength) {
this.displayLength = displayLength;
return this;
}
/**
* Sets the substitute handling.
*
* @param substituteHandling The substitute handling.
* @return Builder
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public Builder setSubstituteHandling(SubstituteHandling substituteHandling) {
this.substituteHandling = substituteHandling;
return this;
}
/**
* Builds the display options.
*
* @return DisplayOptions
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public DisplayOptions build() {
DisplayOptions displayOptions = new DisplayOptions(this);
return displayOptions;
}
}
/**
* Represents all the grammatical noun classes that are supported by CLDR.
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public enum NounClass {
/**
* A possible setting for NounClass. The noun class context to be used is unknown (this is the
* default value).
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
UNDEFINED("undefined"),
/**
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
OTHER("other"),
/**
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
NEUTER("neuter"),
/**
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
FEMININE("feminine"),
/**
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
MASCULINE("masculine"),
/**
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
ANIMATE("animate"),
/**
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
INANIMATE("inanimate"),
/**
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
PERSONAL("personal"),
/**
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
COMMON("common");
private final String identifier;
private NounClass(String identifier) {
this.identifier = identifier;
}
/**
* Unmodifiable List of all noun classes constants. List version of {@link #values()}.
*/
@android.annotation.FlaggedApi(com.android.icu.Flags.FLAG_ICU_V_API)
public static final List