Package dev.agenor.core.spi
Interface BehaviorAnnotationExtension
- All Known Implementing Classes:
ExtBehaviorAnnotationExtension
public interface BehaviorAnnotationExtension
Optional
@Behavior extension covering behavior types whose implementation
classes live outside agenor-runtime (CONDITIONAL, THROTTLED, BATCH, RETRY,
SEQUENTIAL, PARALLEL, FSM — all in agenor-runtime-ext), discovered via
ServiceLoader.
agenor-runtime's core annotation processor handles ONE_SHOT, CYCLIC,
WAKER, EVENT_DRIVEN, and CUSTOM directly, with no optional-module dependency, and
delegates every other BehaviorType to this extension when present. Unlike
other ADR-027 SPI seams, absence of this extension is not a silent no-op: a
@Behavior annotation names its required type explicitly and is always known
at registration time, so using an ext-only type without agenor-runtime-ext
on the classpath fails loudly with an IllegalStateException instead.
- Since:
- 0.25.0
-
Method Summary
Modifier and TypeMethodDescriptioncreateBehavior(Agent agent, Method method, Behavior annotation) Builds the behavior for a@Behavior-annotated method whose type this extensionsupports(BehaviorType).booleansupports(BehaviorType type) Reports whether this extension can build a behavior fortype.
-
Method Details
-
supports
Reports whether this extension can build a behavior fortype.- Parameters:
type- the behavior type requested by a@Behaviorannotation- Returns:
trueif this extension supportstype
-
createBehavior
Builds the behavior for a@Behavior-annotated method whose type this extensionsupports(BehaviorType).- Parameters:
agent- the agent instance being processed; nevernullmethod- the annotated method; nevernullannotation- the annotation itself; nevernull- Returns:
- the constructed behavior, or
nullif construction was skipped (e.g. a required annotation attribute was left empty)
-