Package de.espirit.firstspirit.agency
Interface ScriptAgent
public interface ScriptAgent
Agent providing methods for handling
scripts.- Since:
- 5.2.250706
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SpecialistType<ScriptAgent>The agent's type to be used to look up the agent via aSpecialistsBroker. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckSyntax(@NotNull String source) Verifies the syntax of a script.@Nullable Objectexecute(@NotNull Executable executable, @NotNull Map<String, Object> parameters) Executes the given executable.@Nullable ObjectExecutes the given script.@Nullable ObjectExecutes the script with the given identifier.
-
Field Details
-
TYPE
The agent's type to be used to look up the agent via aSpecialistsBroker.- Since:
- 5.2.250706
-
-
Method Details
-
checkSyntax
Verifies the syntax of a script.- Parameters:
source- The source of the script, must not benull.- Throws:
SyntaxError- If the script could not be parsed.- Since:
- 5.2.250706
-
execute
@Nullable @Nullable Object execute(@NotNull @NotNull String scriptIdentifier, @NotNull @NotNull Map<String, Object> parameters) Executes the script with the given identifier. The parameters are passed toExecutable.execute(Map)after adding a matchingcontextobject with the keycontext.- Parameters:
scriptIdentifier- Either a script UID (e.g.script:my-script, only available in a project-context) or a class name (e.g.class:com.example.script.MyScript). Must not benull.parameters- A map of parameters to be passed to the script. Must not benull.- Returns:
- The result of the script execution, may be
null. - Since:
- 5.2.250706
-
execute
@Nullable @Nullable Object execute(@NotNull @NotNull Script script, @NotNull @NotNull Map<String, Object> parameters) Executes the given script. The parameters are passed to
Executable.execute(Map)after adding a matchingcontextobject with the keycontext.Please note that this method may only be called in a project-context.
- Parameters:
script- The script to execute, must not benull.parameters- A map of parameters to be passed to the script. Must not benull.- Returns:
- The result of the script execution, may be
null. - Since:
- 5.2.250706
-
execute
@Nullable @Nullable Object execute(@NotNull @NotNull Executable executable, @NotNull @NotNull Map<String, Object> parameters) Executes the given executable. The parameters are passed toExecutable.execute(Map)after adding a matchingcontextobject with the keycontext.- Parameters:
executable- The executable to execute, must not benull.parameters- A map of parameters to be passed to the executable. Must not benull.- Returns:
- The result of the execution, may be
null. - Since:
- 5.2.250706
-