Interface Model
-
- All Known Subinterfaces:
ReflectiveModel<T>
- All Known Implementing Classes:
ArrayModel
,ClassModel
public interface Model
This interface can be implemented for each class that needs to be modeled during an analysis.The data tracked and logic to handle the methods of the modeled class are implementation-specific.
The implementations are expected to override
Object.equals(Object)
andObject.hashCode()
to guarantee the expected behavior during the analysis.The interface methods
init
,invoke
, andinvokeStatic
are meant to be used to handle the proper method calls on the modeled object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull java.lang.String
getType()
Returns the type of the modeled class.MethodResult
init(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
Execute a constructor call for the modeled class.MethodResult
invoke(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
Execute an instance method on the modeled object.MethodResult
invokeStatic(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
Execute a static method for the modeled class.
-
-
-
Method Detail
-
getType
@NotNull @NotNull java.lang.String getType()
Returns the type of the modeled class.
-
init
MethodResult init(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
Execute a constructor call for the modeled class.It is suggested to add logic to allow running this only on a dummy model without any state.
- Parameters:
methodExecutionInfo
- execution info of the target method.valueCalculator
- the value calculator that should be used to create any value in the result.- Returns:
- the result of the method invocation. Since it's a constructor invocation the return value of the result is expected to be empty and the constructed value should be set as the updated instance.
-
invoke
MethodResult invoke(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
Execute an instance method on the modeled object. The state of the instance is represented by the state of the model.It is suggested to add logic to allow running this only on a model representing an initialized object.
- Parameters:
methodExecutionInfo
- execution info of the target method.valueCalculator
- the value calculator that should be used to create any value in the result.- Returns:
- the result of the method invocation.
-
invokeStatic
MethodResult invokeStatic(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
Execute a static method for the modeled class.It is suggested to add logic to allow running this only on a dummy model without any state.
- Parameters:
methodExecutionInfo
- execution info of the target method.valueCalculator
- the value calculator that should be used to create any value in the result.- Returns:
- the result of the method invocation.
-
-