private Service generateActionResponse(@Nonnull Class<? extends RetryActionResultDto> response) {
if (response.isSuccess()) {
...
} else if (response.getRetryDecision() {
....
}
}
public interface RetryActionResultDto extends DTO {
public RetryDecision getRetryDecision();
public boolean isSuccess();
}
但我得到了异常(exception)
The method isSuccess() is undefined for the type Class
我能做什么?
最佳答案
你的参数是一个类..而不是该类的实例。因此出现错误。
尝试将其更改为:
private Service generateActionResponse(@Nonnull RetryActionResultDto response) {
if (response.isSuccess()) {
...
} else if (response.getRetryDecision() {
....
}
}
子类的实例也会通过它。
关于java - 类<? extends RetryActionResultDto> 类型 CLASS 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19270351/