Interface CaptionMap
- All Known Implementing Classes:
DummyCaptionMap,LocalizedCaptionMap,PerUserLocaleCaptionMap
public interface CaptionMap
Map containing mappings between
captions and
components-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionGets a copy of the set of captions stored in the CaptionMapGet the locale of the messages stored in the mapgetMessage(@NonNull TranslatableCaption caption) Get a message using the server localegetMessage(@NonNull TranslatableCaption caption, @NonNull LocaleHolder localeHolder) Get a message using a specific localebooleansupportsLocale(@NonNull Locale locale) Check if the map supports a given locale
-
Method Details
-
getMessage
@NonNull String getMessage(@NonNull TranslatableCaption caption) throws CaptionMap.NoSuchCaptionException Get a message using the server locale- Parameters:
caption- Caption containing the caption key- Returns:
- Component
- Throws:
CaptionMap.NoSuchCaptionException- if no caption with the given key exists
-
getMessage
@NonNull String getMessage(@NonNull TranslatableCaption caption, @NonNull LocaleHolder localeHolder) throws CaptionMap.NoSuchCaptionException Get a message using a specific locale- Parameters:
caption- Caption containing the caption keylocaleHolder- Holder that determines the message locale- Returns:
- Component
- Throws:
CaptionMap.NoSuchCaptionException- if no caption with the given key exists
-
supportsLocale
Check if the map supports a given locale- Parameters:
locale- Locale- Returns:
trueif the map supports the locale
-
getLocale
Get the locale of the messages stored in the map- Returns:
- Message locale
-
getCaptions
@NonNull Set<TranslatableCaption> getCaptions()Gets a copy of the set of captions stored in the CaptionMap- Returns:
- An immutable set of TranslatableCaption
-