Package dev.turboism.sdk.appearance
Interface AppearanceService
- All Known Implementing Classes:
AppearanceService.Unavailable
public interface AppearanceService
A plugin's handle on the Editor appearance: read the current state, overlay its own, and put the
Editor's back.
Business outcomes — rejection, unavailability, apply and restore failures — are reported as
result values on the returned stages, so callers can branch on the outcome enums. That does not
make the calls total: an implementation may throw synchronously before returning a stage (for
example on permission denial, a null argument or a provider error), and a returned stage
may itself complete exceptionally. A plugin may only restore an appearance it owns. Where the
host offers no appearance control at all, unavailable() supplies a conformant no-op
implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumSentinel returned byunavailable(): calls that report outcomes complete with the structured unavailability result; and queries report empty results. -
Method Summary
Modifier and TypeMethodDescriptionapply(AppearanceRequest request) Overlays this plugin's appearance on the Editor.current()Returns the appearance state currently in force on the host.default booleanReports whether a live runtime surface backs this instance.Removes the appearance overlay this plugin owns, putting the Editor's own appearance back.static AppearanceService
-
Method Details
-
current
CompletionStage<AppearanceStatus> current()Returns the appearance state currently in force on the host.- Returns:
- a stage for the observed status; see the class contract — synchronous validation failures may still be thrown
-
apply
Overlays this plugin's appearance on the Editor.- Parameters:
request- the requested appearance, including theexpectedRevisionoptimistic-concurrency token from an earliercurrent()result- Returns:
- a stage for the outcome of the attempt; business rejection and failure arrive as values, while permission denial and provider errors may throw synchronously
-
restoreOwnedAppearance
CompletionStage<AppearanceRestoreResult> restoreOwnedAppearance()Removes the appearance overlay this plugin owns, putting the Editor's own appearance back.- Returns:
- a stage for the outcome;
NO_OWNED_OVERRIDEreports a clean no-op when this plugin had nothing installed; permission denial may throw synchronously
-
isAvailable
default boolean isAvailable()Reports whether a live runtime surface backs this instance.- Returns:
falsewhen the backend backing this instance is unavailable, including theunavailable()sentinel
-