接口 Model
-
- 所有已知子接口:
ReflectiveModel<T>
- 所有已知实现类:
ArrayModel,ClassLoaderModel,ClassModel
public interface ModelThis 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, andinvokeStaticare meant to be used to handle the proper method calls on the modeled object.
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 @NotNull java.lang.StringgetType()Returns the type of the modeled class.MethodResultinit(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)Execute a constructor call for the modeled class.MethodResultinvoke(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)Execute an instance method on the modeled object.MethodResultinvokeStatic(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)Execute a static method for the modeled class.
-
-
-
方法详细资料
-
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.
- 参数:
methodExecutionInfo- execution info of the target method.valueCalculator- the value calculator that should be used to create any value in the result.- 返回:
- 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.
- 参数:
methodExecutionInfo- execution info of the target method.valueCalculator- the value calculator that should be used to create any value in the result.- 返回:
- 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.
- 参数:
methodExecutionInfo- execution info of the target method.valueCalculator- the value calculator that should be used to create any value in the result.- 返回:
- the result of the method invocation.
-
-