Package com.scivicslab.pojoactor.core
Class ActionResult
java.lang.Object
com.scivicslab.pojoactor.core.ActionResult
Represents the result of executing an action on an actor.
This class encapsulates the outcome of an action execution, including
whether it succeeded and any result message or data. It is primarily used
with CallableByActionName for string-based method invocation.
Usage Example
public class MathPlugin implements CallableByActionName {
@Override
public ActionResult callByActionName(String actionName, String args) {
if ("add".equals(actionName)) {
String[] parts = args.split(",");
int result = Integer.parseInt(parts[0]) + Integer.parseInt(parts[1]);
return new ActionResult(true, String.valueOf(result));
}
return new ActionResult(false, "Unknown action: " + actionName);
}
}
- Since:
- 2.0.0, 2.0.0
- Author:
- devteam@scivicslab.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ActionResult
Constructs a new ActionResult.- Parameters:
success-trueif the action completed successfully,falseotherwiseresult- a message or data describing the action result
-
-
Method Details