Annotation Provided

  • All Implemented Interfaces:

    @Target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) 
    public @interface Provided
    
                        

    Marks an action method parameter as being provided by the platform context rather than resolved from the blackboard.

    Use this annotation to inject services, components, or other platform-managed objects into action methods. This is particularly useful in @State classes where you need access to the enclosing component or other services without making the state class non-static.

    Example:

    @EmbabelComponent
    class ReservationFlow(
        private val bookingService: BookingService,
    ) {
        @State
        data class CollectDetails(val customerId: String) {
            @Action
            fun confirm(
                details: ReservationDetails,           // From blackboard
                @Provided flow: ReservationFlow,       // From context
            ): ConfirmState {
                return ConfirmState(flow.bookingService.reserve(details))
            }
        }
    }

    The actual resolution is handled by a com.embabel.agent.api.annotation.support.ContextProvider implementation, which is typically provided by the runtime environment (e.g., Spring).

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail