Package nl.vpro.i18n
Interface Displayable
-
public interface Displayable
A displayable has agetDisplayName()
method, to display the object as a single string (inLocales.getDefault()
) to the user.This interface contains only default methods, which call each other. Implementations must override at least one, either
getDisplayName()
if no localization is necessary orgetDisplayName(Locale)
if it is.- Since:
- 2.30
- Author:
- Roelof Jan Koekoek
-
-
Field Summary
Fields Modifier and Type Field Description static Displayable
NULL
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default boolean
display()
Sometimes displayable values are deprecated or experimental.default String
getDisplayName()
Returns the display value in the default locale.default LocalizedString
getDisplayName(Locale locale)
Returns a displayable name for this item in the given Locale, or the default locale (Locales.getDefault()
) if not available or not implementeddefault Optional<String>
getIcon()
An url for an icon associated with this displayable object.default Optional<String>
getIconClass()
An url for an icon associated with this displayable object.default Optional<LocalizedString>
getPluralDisplayName()
ReturnsgetDisplayName(Locale)
for the default localeLocales.getDefault()
default @NonNull Optional<LocalizedString>
getPluralDisplayName(Locale locale)
Returns the plural of the display name, if implemented.static @NonNull Displayable
of(@Nullable Displayable d)
-
-
-
Field Detail
-
NULL
static final Displayable NULL
-
-
Method Detail
-
of
static @NonNull Displayable of(@Nullable Displayable d)
-
getDisplayName
default String getDisplayName()
Returns the display value in the default locale.
-
getDisplayName
default LocalizedString getDisplayName(Locale locale)
Returns a displayable name for this item in the given Locale, or the default locale (Locales.getDefault()
) if not available or not implemented- Since:
- 5.11
-
getPluralDisplayName
default @NonNull Optional<LocalizedString> getPluralDisplayName(Locale locale)
Returns the plural of the display name, if implemented. OtherwiseOptional.empty()
- Since:
- 5.11
-
getPluralDisplayName
default Optional<LocalizedString> getPluralDisplayName()
ReturnsgetDisplayName(Locale)
for the default localeLocales.getDefault()
- Since:
- 5.11
-
getIcon
default Optional<String> getIcon()
An url for an icon associated with this displayable object.It may be that this to be interpreted relative to the current 'context path'.
-
getIconClass
default Optional<String> getIconClass()
An url for an icon associated with this displayable object.It may be that this to be interpreted relative to the current 'context path'.
-
display
default boolean display()
Sometimes displayable values are deprecated or experimental. Their value is possible but they should not be displayed in situations where the value is not yet present. Then this can return false.
-
-