You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit provides documentation for writing and registering a
ActionMethodArgumentResolver.
See gh-890
Signed-off-by: Arjen Poutsma <[email protected]>
Copy file name to clipboardExpand all lines: embabel-agent-docs/src/main/asciidoc/reference/annotations/page.adoc
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ A nullable domain object parameter will be populated if it is non-null on the bl
62
62
This enables nice-to-have parameters that are not required for the action to run.
63
63
In Kotlin, use a nullable parameter with `?`: in Java, mark the parameter with the `org.springframework.lang.Nullable` or another `Nullable` annotation.
64
64
65
-
* _Infrastructure objects_. `OperationContext` parameters may be passed to action or condition methods.
65
+
* _Infrastructure parameters_, such as the `OperationContext`, `ProcessContext`, and `Ai` may be used in action or condition methods.
66
66
67
67
NOTE: Domain objects drive planning, specifying the preconditions to an action.
68
68
@@ -73,6 +73,23 @@ This is an important element of composition.
73
73
> Use the least specific type possible for parameters.
74
74
Use `OperationContext` unless you are creating a subprocess.
75
75
76
+
===== Custom Parameters
77
+
78
+
Besides two default parameter categories described above, you can provide your own parameters by implementing the `ActionMethodArgumentResolver` interface.
79
+
The two main methods of this interface are:
80
+
81
+
* `supportsParameter`, which indicates what kind of parameters are supported, and
82
+
* `resolveArgument`, which resolves the argument into an object used to invoke the action method.
83
+
84
+
NOTE: Note the similarity with Spring MVC, where you can provide custom parameters by implementing a `HandlerMethodArgumentResolver`.
85
+
86
+
> All default parameters are provided by `ActionMethodArgumentResolver` implementations.
87
+
88
+
To register your custom argument resolver, provide it to the `DefaultActionMethodManager` component in your Spring configuration.
89
+
Typically, you will register (some of) the defaults as well your custom resolver, in order to support the default parameters.
90
+
91
+
TIP: Make sure to register the `BlackboardArgumentResolver` as last resolver, to ensure that others take precedence.
92
+
76
93
==== Binding by name
77
94
78
95
The `@RequireNameMatch` annotation can be used to <<reference.flow__binding, bind parameters by name>>.
0 commit comments