public class MethodResult
extends java.lang.Object
In case of side effects the new value should have a reference identifier corresponding to the original argument. If the analysis supports it, this information can be used to replace all the values with the same reference value with the updated one.
Modifier and Type | Class and Description |
---|---|
static class |
MethodResult.Builder
A builder for
MethodResult . |
Modifier and Type | Method and Description |
---|---|
@Nullable Value |
getReturnValue()
The return value of the method invocation if
isReturnValuePresent , throws
otherwise. |
@Nullable ReferenceValue |
getUpdatedInstance()
The updated instance value after a method invocation if
isInstanceUpdated() , throws otherwise. |
@Nullable java.util.List<Value> |
getUpdatedParameters()
The updated parameter value after a method invocation if
isAnyParameterUpdated() , throws otherwise. |
static MethodResult |
invalidResult()
Returns a result communicating to the receiver that the creator is not able to provide any
additional information about the method execution.
|
boolean |
isAnyParameterUpdated()
Whether any parameter was updated during method execution.
|
boolean |
isInstanceUpdated()
Whether the calling instance was updated during method execution.
|
boolean |
isResultValid()
Returns whether the result is invalid (i.e., whether it was created via
invalidResult() ). |
boolean |
isReturnValuePresent()
Whether the result provides a return value.
|
public static MethodResult invalidResult()
This should be the only way to communicate this type of information, while any other result with all empty parameters means a method returning void and with no side effects.
public boolean isResultValid()
invalidResult()
).public boolean isReturnValuePresent()
public boolean isInstanceUpdated()
public boolean isAnyParameterUpdated()
@Nullable public @Nullable Value getReturnValue()
isReturnValuePresent
, throws
otherwise.@Nullable public @Nullable ReferenceValue getUpdatedInstance()
isInstanceUpdated()
, throws otherwise.
The identifier of the returned value can be matched to identify the old values using the same reference.
@Nullable public @Nullable java.util.List<Value> getUpdatedParameters()
isAnyParameterUpdated()
, throws otherwise.
Each element of the list (corresponding to the parameter position, instance not included and the first parameter is always element 0) contains either null, if the specific parameter was not updated, or the updated parameter value.
The identifier of the returned values can be matched to identify the old values using the same reference.