diff --git a/api/src/main/java/net/kyori/adventure/text/Component.java b/api/src/main/java/net/kyori/adventure/text/Component.java index 995b8c0ac..f127db1b1 100644 --- a/api/src/main/java/net/kyori/adventure/text/Component.java +++ b/api/src/main/java/net/kyori/adventure/text/Component.java @@ -1278,6 +1278,32 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), Style.empty()); } + /** + * Creates a translatable component with a translation key and an optional fallback string. + * + * @param key the translation key + * @param fallback the fallback string + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback) { + return translatable(key, fallback, Style.empty()); + } + + /** + * Creates a translatable component with a translation key and an optional fallback string. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, Style.empty()); + } + /** * Creates a translatable component with a translation key and styling. * @@ -1304,6 +1330,34 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), style); } + /** + * Creates a translatable component with a translation key, optional fallback string, and styling. + * + * @param key the translation key + * @param fallback the fallback string + * @param style the style + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @NotNull Style style) { + return TranslatableComponentImpl.create(Collections.emptyList(), requireNonNull(style, "style"), fallback, key, Collections.emptyList()); + } + + /** + * Creates a translatable component with a translation key, optional fallback string, and styling. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param style the style + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @NotNull Style style) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, style); + } + /** * Creates a translatable component with a translation key, and optional color. * @@ -1330,6 +1384,34 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), color); } + /** + * Creates a translatable component with a translation key, optional fallback string, and optional color. + * + * @param key the translation key + * @param fallback the fallback string + * @param color the color + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @Nullable TextColor color) { + return translatable(key, fallback, Style.style(color)); + } + + /** + * Creates a translatable component with a translation key, optional fallback string, and optional color. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param color the color + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _ , _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @Nullable TextColor color) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, color); + } + /** * Creates a translatable component with a translation key, and optional color and decorations. * @@ -1358,6 +1440,36 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), color, decorations); } + /** + * Creates a translatable component with a translation key, optional fallback string, and optional color and decorations. + * + * @param key the translation key + * @param fallback the fallback string + * @param color the color + * @param decorations the decorations + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @Nullable TextColor color, final TextDecoration@NotNull... decorations) { + return translatable(key, fallback, Style.style(color, decorations)); + } + + /** + * Creates a translatable component with a translation key, optional fallback string, and optional color and decorations. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param color the color + * @param decorations the decorations + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @Nullable TextColor color, final TextDecoration@NotNull... decorations) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, color, decorations); + } + /** * Creates a translatable component with a translation key, and optional color and decorations. * @@ -1386,6 +1498,36 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), color, decorations); } + /** + * Creates a translatable component with a translation key, an optional fallback string, and optional color and decorations. + * + * @param key the translation key + * @param fallback the fallback string + * @param color the color + * @param decorations the decorations + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @Nullable TextColor color, final @NotNull Set decorations) { + return translatable(key, fallback, Style.style(color, decorations)); + } + + /** + * Creates a translatable component with a translation key, an optional fallback string, and optional color and decorations. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param color the color + * @param decorations the decorations + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @Nullable TextColor color, final @NotNull Set decorations) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, color, decorations); + } + /** * Creates a translatable component with a translation key and arguments. * @@ -1412,6 +1554,34 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), args); } + /** + * Creates a translatable component with a translation key, optional fallback string, and arguments. + * + * @param key the translation key + * @param fallback the fallback string + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @NotNull ComponentLike@NotNull... args) { + return translatable(key, fallback, Style.empty(), args); + } + + /** + * Creates a translatable component with a translation key, optional fallback string, and arguments. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @NotNull ComponentLike@NotNull... args) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, args); + } + /** * Creates a translatable component with a translation key and styling. * @@ -1440,6 +1610,36 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), style, args); } + /** + * Creates a translatable component with a translation key, optional fallback string, and styling. + * + * @param key the translation key + * @param fallback the fallback string + * @param style the style + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @NotNull Style style, final @NotNull ComponentLike@NotNull... args) { + return TranslatableComponentImpl.create(Collections.emptyList(), requireNonNull(style, "style"), key, fallback, requireNonNull(args, "args")); + } + + /** + * Creates a translatable component with a translation key, optional fallback string, and styling. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param style the style + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @NotNull Style style, final @NotNull ComponentLike@NotNull... args) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, style, args); + } + /** * Creates a translatable component with a translation key, arguments, and optional color. * @@ -1468,6 +1668,36 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), color, args); } + /** + * Creates a translatable component with a translation key, optional fallback string, arguments, and optional color. + * + * @param key the translation key + * @param fallback the fallback string + * @param color the color + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @Nullable TextColor color, final @NotNull ComponentLike@NotNull... args) { + return translatable(key, fallback, Style.style(color), args); + } + + /** + * Creates a translatable component with a translation key, optional fallback string, arguments, and optional color. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param color the color + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @Nullable TextColor color, final @NotNull ComponentLike@NotNull... args) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, color, args); + } + /** * Creates a translatable component with a translation key, arguments, and optional color and decorations. * @@ -1498,6 +1728,38 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), color, decorations, args); } + /** + * Creates a translatable component with a translation key, optional fallback string, arguments, and optional color and decorations. + * + * @param key the translation key + * @param fallback the fallback string + * @param color the color + * @param decorations the decorations + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @Nullable TextColor color, final @NotNull Set decorations, final @NotNull ComponentLike@NotNull... args) { + return translatable(key, fallback, Style.style(color, decorations), args); + } + + /** + * Creates a translatable component with a translation key, optional fallback string, arguments, and optional color and decorations. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param color the color + * @param decorations the decorations + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @Nullable TextColor color, final @NotNull Set decorations, final @NotNull ComponentLike@NotNull... args) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, color, decorations, args); + } + /** * Creates a translatable component with a translation key and arguments. * @@ -1524,6 +1786,34 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), args); } + /** + * Creates a translatable component with a translation key, optional fallback string, and arguments. + * + * @param key the translation key + * @param fallback the fallback string + * @param args the translation arguments + * @return a translatable component + * @since 4.0.0 + */ + @Contract(value = "_, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @NotNull List args) { + return TranslatableComponentImpl.create(Collections.emptyList(), Style.empty(), key, fallback, requireNonNull(args, "args")); + } + + /** + * Creates a translatable component with a translation key, optional fallback string, and arguments. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param args the translation arguments + * @return a translatable component + * @since 4.8.0 + */ + @Contract(value = "_, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @NotNull List args) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, args); + } + /** * Creates a translatable component with a translation key and styling. * @@ -1552,6 +1842,36 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex return translatable(requireNonNull(translatable, "translatable").translationKey(), style, args); } + /** + * Creates a translatable component with a translation key, an optional fallback string, and styling. + * + * @param key the translation key + * @param fallback the fallback string + * @param style the style + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @NotNull Style style, final @NotNull List args) { + return TranslatableComponentImpl.create(Collections.emptyList(), requireNonNull(style, "style"), key, fallback, requireNonNull(args, "args")); + } + + /** + * Creates a translatable component with a translation key, an optional fallback string, and styling. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param style the style + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @NotNull Style style, final @NotNull List args) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, style, args); + } + /** * Creates a translatable component with a translation key, arguments, and optional color. * @@ -1580,6 +1900,36 @@ static TranslatableComponent translatable(final @NotNull Translatable translatab return translatable(requireNonNull(translatable, "translatable").translationKey(), color, args); } + /** + * Creates a translatable component with a translation key, optional fallback string, arguments, and optional color. + * + * @param key the translation key + * @param fallback the fallback string + * @param color the color + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @Nullable TextColor color, final @NotNull List args) { + return translatable(key, fallback, Style.style(color), args); + } + + /** + * Creates a translatable component with a translation key, optional fallback string, arguments, and optional color. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param color the color + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _ -> new", pure = true) + static TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @Nullable TextColor color, final @NotNull List args) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, color, args); + } + /** * Creates a translatable component with a translation key, arguments, and optional color and decorations. * @@ -1610,6 +1960,38 @@ static TranslatableComponent translatable(final @NotNull Translatable translatab return translatable(requireNonNull(translatable, "translatable").translationKey(), color, decorations, args); } + /** + * Creates a translatable component with a translation key, optional fallback string, arguments, and optional color and decorations. + * + * @param key the translation key + * @param fallback the fallback string + * @param color the color + * @param decorations the decorations + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull String key, final @Nullable String fallback, final @Nullable TextColor color, final @NotNull Set decorations, final @NotNull List args) { + return translatable(key, fallback, Style.style(color, decorations), args); + } + + /** + * Creates a translatable component with a translation key, optional fallback string, arguments, and optional color and decorations. + * + * @param translatable the translatable object to get the key from + * @param fallback the fallback string + * @param color the color + * @param decorations the decorations + * @param args the translation arguments + * @return a translatable component + * @since 4.13.0 + */ + @Contract(value = "_, _, _, _, _ -> new", pure = true) + static @NotNull TranslatableComponent translatable(final @NotNull Translatable translatable, final @Nullable String fallback, final @Nullable TextColor color, final @NotNull Set decorations, final @NotNull List args) { + return translatable(requireNonNull(translatable, "translatable").translationKey(), fallback, color, decorations, args); + } + /** * Gets the unmodifiable list of children. * diff --git a/api/src/main/java/net/kyori/adventure/text/TranslatableComponent.java b/api/src/main/java/net/kyori/adventure/text/TranslatableComponent.java index 8b787d89e..55e561418 100644 --- a/api/src/main/java/net/kyori/adventure/text/TranslatableComponent.java +++ b/api/src/main/java/net/kyori/adventure/text/TranslatableComponent.java @@ -92,24 +92,6 @@ public interface TranslatableComponent extends BuildableComponent args); + /** + * Gets the translation fallback text for this component. + * The fallback text will be shown when the client doesn't know the + * translation key used in the translatable component. + * + * @return the fallback string + * @since 4.13.0 + */ + @Nullable String fallback(); + + /** + * Sets the translation fallback text for this component. + * The fallback text will be shown when the client doesn't know the + * translation key used in the translatable component. + * + * @param fallback the fallback string + * @return this builder + * @since 4.13.0 + */ + @Contract(pure = true) + @NotNull TranslatableComponent fallback(final @NotNull String fallback); + @Override default @NotNull Stream examinableProperties() { return Stream.concat( Stream.of( ExaminableProperty.of("key", this.key()), - ExaminableProperty.of("args", this.args()) + ExaminableProperty.of("args", this.args()), + ExaminableProperty.of("fallback", this.fallback()) ), BuildableComponent.super.examinableProperties() ); @@ -177,16 +182,6 @@ interface Builder extends ComponentBuilder { @Contract("_ -> this") @NotNull Builder key(final @NotNull String key); - /** - * Sets the fallback string. - * - * @param fallback the fallback string - * @return this builder - * @since 4.13.0 - */ - @Contract("_ -> this") - @NotNull Builder fallback(final @NotNull String fallback); - /** * Sets the translation args. * @@ -237,5 +232,17 @@ interface Builder extends ComponentBuilder { */ @Contract("_ -> this") @NotNull Builder args(final @NotNull List args); + + /** + * Sets the translation fallback text. + * The fallback text will be shown when the client doesn't know the + * translation key used in the translatable component. + * + * @param fallback the fallback string + * @return this builder + * @since 4.13.0 + */ + @Contract("_ -> this") + @NotNull Builder fallback(final @Nullable String fallback); } } diff --git a/api/src/main/java/net/kyori/adventure/text/TranslatableComponentImpl.java b/api/src/main/java/net/kyori/adventure/text/TranslatableComponentImpl.java index db6504c91..df7f1c735 100644 --- a/api/src/main/java/net/kyori/adventure/text/TranslatableComponentImpl.java +++ b/api/src/main/java/net/kyori/adventure/text/TranslatableComponentImpl.java @@ -74,16 +74,6 @@ static TranslatableComponent create(final @NotNull List return create(this.children, this.style, key, this.fallback, this.args); } - @Override - public @Nullable String fallback() { - return this.fallback; - } - - @Override - public @NotNull TranslatableComponent fallback(final @Nullable String fallback) { - return create(this.children, this.style, this.key, fallback, this.args); - } - @Override public @NotNull List args() { return this.args; @@ -99,6 +89,16 @@ static TranslatableComponent create(final @NotNull List return create(this.children, this.style, this.key, this.fallback, args); } + @Override + public @Nullable String fallback() { + return this.fallback; + } + + @Override + public @NotNull TranslatableComponent fallback(final @Nullable String fallback) { + return create(this.children, this.style, this.key, fallback, this.args); + } + @Override public @NotNull TranslatableComponent children(final @NotNull List children) { return create(children, this.style, this.key, this.fallback, this.args); @@ -149,6 +149,7 @@ static final class BuilderImpl extends AbstractComponentBuilder arg) { return this.args(Collections.singletonList(requireNonNull(arg, "arg").build())); @@ -194,6 +189,12 @@ static final class BuilderImpl extends AbstractComponentBuilder { static final String TEXT = "text"; static final String TRANSLATE = "translate"; static final String TRANSLATE_WITH = "with"; + static final String FALLBACK = "fallback"; static final String SCORE = "score"; static final String SCORE_NAME = "name"; static final String SCORE_OBJECTIVE = "objective"; @@ -207,6 +208,7 @@ public void serialize(final @NotNull TypeToken type, final @Nullable Componen with.appendListNode().setValue(TYPE, arg); } } + value.getNode(FALLBACK).setValue(tc.fallback()); } else if (src instanceof ScoreComponent) { final ScoreComponent sc = (ScoreComponent) src; final ConfigurationNode score = value.getNode(SCORE); diff --git a/serializer-configurate4/src/main/java/net/kyori/adventure/serializer/configurate4/ComponentTypeSerializer.java b/serializer-configurate4/src/main/java/net/kyori/adventure/serializer/configurate4/ComponentTypeSerializer.java index afa1b5701..bf9ab801e 100644 --- a/serializer-configurate4/src/main/java/net/kyori/adventure/serializer/configurate4/ComponentTypeSerializer.java +++ b/serializer-configurate4/src/main/java/net/kyori/adventure/serializer/configurate4/ComponentTypeSerializer.java @@ -53,6 +53,7 @@ final class ComponentTypeSerializer implements TypeSerializer { static final String TEXT = "text"; static final String TRANSLATE = "translate"; static final String TRANSLATE_WITH = "with"; + static final String FALLBACK = "fallback"; static final String SCORE = "score"; static final String SCORE_NAME = "name"; static final String SCORE_OBJECTIVE = "objective"; @@ -205,6 +206,7 @@ public void serialize(final @NotNull Type type, final @Nullable Component src, f with.appendListNode().set(Component.class, arg); } } + value.node(FALLBACK).set(tc.fallback()); } else if (src instanceof ScoreComponent) { final ScoreComponent sc = (ScoreComponent) src; final ConfigurationNode score = value.node(SCORE); diff --git a/text-serializer-gson/src/main/java/net/kyori/adventure/text/serializer/gson/ComponentSerializerImpl.java b/text-serializer-gson/src/main/java/net/kyori/adventure/text/serializer/gson/ComponentSerializerImpl.java index 88a1d0ca3..e938a1a3e 100644 --- a/text-serializer-gson/src/main/java/net/kyori/adventure/text/serializer/gson/ComponentSerializerImpl.java +++ b/text-serializer-gson/src/main/java/net/kyori/adventure/text/serializer/gson/ComponentSerializerImpl.java @@ -58,6 +58,7 @@ final class ComponentSerializerImpl extends TypeAdapter { static final String TRANSLATE = "translate"; static final String TRANSLATE_FALLBACK = "fallback"; static final String TRANSLATE_WITH = "with"; + static final String FALLBACK = "fallback"; static final String SCORE = "score"; static final String SCORE_NAME = "name"; static final String SCORE_OBJECTIVE = "objective"; @@ -274,6 +275,10 @@ public void write(final JsonWriter out, final Component value) throws IOExceptio out.name(TRANSLATE_WITH); this.gson.toJson(translatable.args(), COMPONENT_LIST_TYPE, out); } + if (translatable.fallback() != null) { + out.name(FALLBACK); + out.value(translatable.fallback()); + } } else if (value instanceof ScoreComponent) { final ScoreComponent score = (ScoreComponent) value; out.name(SCORE);