Class ToolResult
java.lang.Object
org.snmp4j.mcp.tool.ToolResult
Represents the result of a tool execution.
- Since:
- 0.0.1
- Version:
- 0.1.0
- Author:
- SNMP4J.org
-
Constructor Summary
ConstructorsConstructorDescriptionToolResult(boolean success, Object result, String message) Creates a new tool result. -
Method Summary
Modifier and TypeMethodDescriptionAdds additional data to the result.static ToolResultCreates a failed result.static ToolResultCreates a failed result with result data.Gets all additional data.Gets additional data by key.Gets the result message.Gets the result data.booleanChecks if the execution was successful.static ToolResultCreates a successful result.static ToolResultCreates a successful result with a message.
-
Constructor Details
-
ToolResult
-
-
Method Details
-
success
Creates a successful result.- Parameters:
result- the result data- Returns:
- a tool result
-
success
Creates a successful result with a message.- Parameters:
result- the result datamessage- the success message- Returns:
- a tool result
-
failure
Creates a failed result.- Parameters:
message- the error message- Returns:
- a tool result
-
failure
Creates a failed result with result data.- Parameters:
message- the error messageresult- the result data (may contain partial results)- Returns:
- a tool result
-
isSuccess
public boolean isSuccess()Checks if the execution was successful.- Returns:
- true if successful, false otherwise
-
getResult
-
getMessage
-
addData
Adds additional data to the result.- Parameters:
key- the data keyvalue- the data value- Returns:
- this result for chaining
-
getData
-
getAllData
-