/** * @param issueData optional user data. May not contain <code>null</code> entries. */ protected AbstractValidationDiagnostic(int severity, String message, EObject source, CheckType checkType, String issueCode, String... issueData) { if (Arrays.contains(issueData, null)) { throw new NullPointerException("issueData may not contain null"); } this.source = source; this.severity = severity; this.message = message; this.issueCode = issueCode; this.checkType = checkType; this.issueData = issueData; }
/** * @param data optional user data. May not contain <code>null</code> entries. * @throws NullPointerException if node is <code>null</code> or data contains <code>null</code>. */ public XtextLinkingDiagnostic(INode node, String message, String code, String... data) { if (node == null) throw new NullPointerException("node may not be null"); if (Arrays.contains(data, null)) { throw new NullPointerException("data may not contain null"); } this.node = node; this.message = message; this.code = code; this.data = data; }
public static JavaVersion fromQualifier(String qualifier) { JavaVersion[] values = JavaVersion.values(); // iterate backwards since it's a fair assumption that we'll use a more recent java version for(int i = values.length - 1; i >= 0; i--) { JavaVersion candidate = values[i]; if (Arrays.contains(candidate.qualifiers, qualifier)) return candidate; } return null; }
@Override public boolean apply(Issue input) { if (issuecode.equals(input.getCode())) { return userData == null || Arrays.contains(input.getData(), userData); } return false; } });
protected boolean isUserDataEqual(IEObjectDescription oldObj, IEObjectDescription newObj) { String[] oldKeys = oldObj.getUserDataKeys(); String[] newKeys = newObj.getUserDataKeys(); if (oldKeys.length != newKeys.length) return false; for (String key : oldKeys) { if (!Arrays.contains(newKeys, key)) return false; String oldValue = oldObj.getUserData(key); String newValue = newObj.getUserData(key); if (!Objects.equal(oldValue, newValue)) return false; } return true; } }
protected boolean equals(IEObjectDescription oldObj, IEObjectDescription newObj) { if (oldObj == newObj) return true; if (oldObj.getEClass() != newObj.getEClass()) return false; if (oldObj.getName() != null && !oldObj.getName().equals(newObj.getName())) return false; if (!oldObj.getEObjectURI().equals(newObj.getEObjectURI())) return false; String[] oldKeys = oldObj.getUserDataKeys(); String[] newKeys = newObj.getUserDataKeys(); if (oldKeys.length != newKeys.length) return false; for (String key : oldKeys) { if (!Arrays.contains(newKeys, key)) return false; String oldValue = oldObj.getUserData(key); String newValue = newObj.getUserData(key); if (oldValue == null) { if (newValue != null) return false; } else if (!oldValue.equals(newValue)) { return false; } } return true; }