public static List<Message> decodePayload(final String jsonString) { if (jsonString == null || jsonString.trim().length() == 0) return Collections.emptyList(); final JSONValue val = JSONParser.parseStrict(jsonString); if (val == null || val.isArray() == null) { throw new RuntimeException("illegal payload: must be JSONArray"); } final JSONArray jsonArray = val.isArray(); final List<Message> messageList = new ArrayList<Message>(jsonArray.size()); for (int i = 0; i < jsonArray.size(); i++) { messageList.add(decodeCommandMessage(GWTJSON.wrap(jsonArray.get(i)))); } return messageList; }
@Override public T decode(String value) throws DecodingException { try { return decode(JSONParser.parseStrict(value)); } catch (JSONException e) { // that can happen for generic key types like Object and then a String key gets passed in return decode(JSONParser.parseStrict("\"" + value + "\"")); } }
public static TestFindParametersDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static TestFindParametersDto fromJson(JSONValue jsonVal) {
public static TestPositionDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static TestPositionDto fromJson(JSONValue jsonVal) {
public static PackageFragmentDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static PackageFragmentDto fromJson(JSONValue jsonVal) {
public static RenameSettingsDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static RenameSettingsDto fromJson(JSONValue jsonVal) {
public static YamlDTOImpl fromJsonString(String jsonString) { if (jsonString == null) { return null; } return fromJsonObjectInt(JSONParser.parseStrict(jsonString), false); }
public static ExternalLibrariesParametersDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static ExternalLibrariesParametersDto fromJson(JSONValue jsonVal) {
public static TestPositionParametersDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static TestPositionParametersDto fromJson(JSONValue jsonVal) {
public static JobResultDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static JobResultDto fromJson(JSONValue jsonVal) {
public static OrganizeImportParamsDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static OrganizeImportParamsDto fromJson(JSONValue jsonVal) {
public static UpdateClasspathParametersDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static UpdateClasspathParametersDto fromJson(JSONValue jsonVal) {
public static ImplementersResponseDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static ImplementersResponseDto fromJson(JSONValue jsonVal) {
public static CheWorkspaceEditDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static CheWorkspaceEditDto fromJson(JSONValue jsonVal) {
public static RefactoringResultDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static RefactoringResultDto fromJson(JSONValue jsonVal) {
public static ReImportMavenProjectsCommandParametersDto fromJson(String json) { if (json == null) { return null; } return fromJson(JSONParser.parseStrict(json)); } public static ReImportMavenProjectsCommandParametersDto fromJson(JSONValue jsonVal) {
/** * Transforms Errai JSON into a Jackson compatible JSON. * * @param erraiJson * JSON generated by Errai * @return jackson compatible JSON */ public static String toJackson(String erraiJson) { JSONValue val = JSONParser.parseStrict(erraiJson); val = toJackson(val, null, null, new HashMap<String, JSONValue>()); return val.toString(); }
private static Map<String, JSONValue> readPreferencesFromJson(String jsonPreferences) { Map<String, JSONValue> result = new HashMap<>(); JSONValue parsed = JSONParser.parseStrict(jsonPreferences); JSONObject jsonObj = parsed.isObject(); if (jsonObj != null) { jsonObj.keySet().forEach(key -> result.put(key, jsonObj.get(key))); } return result; } }
@Override protected JSONValue parseResult() throws Exception { try { return JSONParser.parseStrict(response.getText()); } catch (Throwable e) { throw new ResponseFormatException("Response was NOT a valid JSON document", e); } } });
@Override protected JSONValue parseResult() throws Exception { try { return JSONParser.parseStrict(response.getText()); } catch (Throwable e) { throw new ResponseFormatException("Response was NOT a valid JSON document", e); } } });