[英]NoraUI - “Cannot infer Type argument” error using Result.Warning<> in a custom step
我需要在一種情況下發出警告,但我不會停止出現此錯誤:“無法推斷Result.Warning <>的類型參數”
實際上,直到現在,我都試圖以提出失敗的相同方式提出警告:
new Result.Warning<>(targetKey, Messages.format(TaroMessages.WARNING_RESOURCES_VALUE_DIFFERENCE_AFTER_REAFFECTATION, existing_value, new_value), true, oscarAccesClientPage.getCallBack());
我在其中使用的自定義步驟如下:我試圖遍歷Element列表,並檢查它們的現有值是否與之前保存的值相同或不同。
protected void checkXyResourcesValue(Integer xyIterator, List<WebElement> elements, String keyParameter) throws TechnicalException, FailureException {
try {
Integer resIterator = 1;
for(WebElement element : elements) {
String targetKey = "XY" + xyIterator + "RES" + resIterator + keyParameter;
String new_value = element.getAttribute(VALUE) != null ? element.getAttribute(VALUE) : element.getText();
String existing_value = Context.getValue(targetKey) != null ? Context.getValue(targetKey) : targetKey;
if (new_value != existing_value) {
new Result.Warning<>(targetKey, Messages.format(TaroMessages.WARNING_RESOURCES_VALUE_DIFFERENCE_AFTER_REAFFECTATION, existing_value, new_value), true, oscarAccesClientPage.getCallBack());
}
resIterator++;
}
} catch (Exception e) {
new Result.Failure<>(e.getMessage(), Messages.format(TaroMessages.FAIL_MESSAGE_ACCES_CLIENT_XY_CHECK_RESOURCES_VALUE, keyParameter, xyIterator), true, oscarAccesClientPage.getCallBack());
}
}
對於檢查和保存值的方法,我實際上是從NoraUI的代碼段中獲得靈感的,以便在Context上保存值或從中讀取值。
我正在使用Eclipse Luna 4.4.2,並且嘗試使用JDK1.8.0_131進行編譯。
與實際問題相比,我可能更不了解我在Java中的工作方式,所以在此先感謝您的幫助或見解。 不要猶豫,詢問您是否需要有關代碼段或上下文的更多信息。
新的Result.Warning <>(targetKey,Messages.format(TaroMessages.WARNING_RESOURCES_VALUE_DIFFERENCE_AFTER_REAFFECTATION,existing_value,new_value),true, 0 );
如果您不使用任何模型(已序列化的數據)或在序列中使用對象的ID,請使用0。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.