private boolean isOnlyWarnings(List<ErrorDescriptor> list) { for (ErrorDescriptor errorDescriptor : list) { if (errorDescriptor.getSeverity() == Severity.ERROR) { return false; } } return true; }
private String generateResponseWithErrors(List<ErrorDescriptor> errors) { JSONArray jsonArray = new JSONArray(); for (ErrorDescriptor error : errors) { StringBuilder message = new StringBuilder(); message .append("(") .append(error.getInterval().startPoint.line + 1) .append(", ") .append(error.getInterval().startPoint.charNumber + 1) .append(")"); message.append(" - "); message.append(error.getMessage()); Map<String, String> map = new HashMap<String, String>(); map.put("type", error.getSeverity().name()); map.put("message", message.toString()); jsonArray.put(map); } return jsonArray.toString(); }