Interface McpLocalizationResult
- All Known Implementing Classes:
McpLocalizationResult.Failure, McpLocalizationResult.Localized, McpLocalizationResult.UseDefaultText
@ThreadSafe
public sealed interface McpLocalizationResult
permits McpLocalizationResult.Localized, McpLocalizationResult.UseDefaultText, McpLocalizationResult.Failure
Immutable outcome of localizing one MCP presentation field.
This is a closed domain; exhaustive switches are supported, and any new alternative requires an explicit reviewed contract amendment.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classReports an unexpected lookup failure without carrying a throwable, message, key, coordinate, locale, revision, or other diagnostic data.static final classText successfully resolved for the localization context.static final classRequests publication of the canonical default text for this field. -
Method Summary
Static MethodsModifier and TypeMethodDescriptionfailure()Creates the data-free outcome for an unexpected localization lookup failure.Creates text successfully resolved for the localization context.
-
Method Details
-
localized
Creates text successfully resolved for the localization context. The provider owns locale matching and fallback, so the text may come from the selected locale, a parent locale, or a localization-library fallback.- Parameters:
text- localized nonblank text- Returns:
- localized result
- Throws:
NullPointerException- iftextis nullIllegalArgumentException- iftextis blank
-
useDefaultText
- Returns:
- result requesting the canonical default field
-
failure
Creates the data-free outcome for an unexpected localization lookup failure. This outcome applies the localizer's whole-response failure policy; it is not an ordinary missing-translation result.- Returns:
- failure result
-