Class Actions
Home of dispatchedByFramework(): the canonical body for a method
whose execution is delegated to ActionExecutor rather than run by Java
method invocation. Use it as the default body of any
@Capability interface method, or
to replace the legacy return null; on concrete
@ActionSpec methods whose bodies the
framework skips (LLM / MCP / WEB_SERVICE without an ActionResult
parameter).
The throw, not a null return, is the whole point: if anyone ever invokes
the method outside the framework dispatch path, the call blows up loudly with
a clear message instead of silently handing back null and confusing
the caller about whether the LLM actually ran.
- Since:
- 0.4.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDedicated exception type so tests can assert the cause without string-matching and operators can wire dedicated alerts on this failure mode. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringStable message prefix so log greps and test assertions don't break on a rewording. -
Method Summary
Modifier and TypeMethodDescriptionstatic RuntimeExceptionReturns aRuntimeExceptiondescribing the bypass.static RuntimeExceptiondispatchedByFramework(String roleName, String methodName) Returns a contextualised variant that names the role + method in the message.
-
Field Details
-
DISPATCHED_MESSAGE_PREFIX
Stable message prefix so log greps and test assertions don't break on a rewording.- See Also:
-
-
Method Details
-
dispatchedByFramework
Returns aRuntimeExceptiondescribing the bypass.Callers
throwthis from the method body. Not returned by value — returning it would let silent-call sites quietly keep going.Standard usage (concrete class):
Standard usage (capability interface):@ActionSpec(type = ActionType.LLM, ...) public String summarize(String text) { throw Actions.dispatchedByFramework(); }@Capability public interface Summarizer { @ActionSpec(type = ActionType.LLM, ...) default String summarize(String text) { throw Actions.dispatchedByFramework(); } }- Returns:
- an exception ready to be thrown
-
dispatchedByFramework
Returns a contextualised variant that names the role + method in the message. Preferred when you can cheaply supply the context; otherwise use the no-arg form.- Parameters:
roleName- human-readable role identifiermethodName- the method that was invoked directly- Returns:
- an exception ready to be thrown
-