@Override @SuppressWarnings("unchecked") public Map<String, Map<String, String>> loadWorkspace(File workspace) { requireNotNull(workspace, "Workspace file cannot be null"); Map<String, Map<String, String>> data = Collections.emptyMap(); try (FileInputStream stream = new FileInputStream(workspace)) { data = (Map) JSON.std.mapFrom(stream); } catch (Exception e) { // make it unchecked throw new RuntimeException(e); } return data; }
@Override public String getLatestVersion() { try { return JSON.std.mapFrom(jsonSource).getOrDefault(CURRENT_VERSION_KEY, "").toString(); } catch (IOException e) { LOG.warn(DefaultI18nContext.getInstance().i18n("Unable to find the latest available version."), e); } return EMPTY; }
@Override public Map<?,?> _readMap(InputStream input) throws Exception { return json.mapFrom(input); }
@Override public Map<?,?> _readMap(String input) throws Exception { return json.mapFrom(input); } }
@Override public Map<?,?> _readMap(byte[] input) throws Exception { return json.mapFrom(input); }
private String getField(String fieldName) throws JSONObjectException, IOException { Object field = JSON.std.mapFrom(rrec.toString()).get(fieldName); return field != null ? field.toString() : null; }
private String getFieldFromRequestRecord(RequestRecord requestRecord, String key) throws JSONObjectException, IOException { return JSON.std.mapFrom(requestRecord.toString()).get(key).toString(); } }
outputStream.write(postBody.getBytes("UTF-8")); } else { Map<String, Object> map = JSON.std.mapFrom(postBody); Iterator<?> it = map.entrySet().iterator(); while (it.hasNext()) {
outputStream.write(postBody.getBytes("UTF-8")); } else { Map<String, Object> map = JSON.std.mapFrom(postBody); Iterator<?> it = map.entrySet().iterator(); while (it.hasNext()) {
outputStream.write(postBody.getBytes("UTF-8")); } else { Map<String, Object> map = JSON.std.mapFrom(postBody); Iterator<?> it = map.entrySet().iterator(); while (it.hasNext()) {
if (vcap != null) { try { Map<String, Object> envMap = JSON.std.mapFrom(vcap);
public Map<String, Object> query(String definition, Request request) { HttpURLConnection connection = null; Map<String, Object> jsonMap = null; Map<String, Object> variables = request != null ? request.toGraphQLVariables() : null; String requestString = formatGraphQLRequest(definition, variables); String contentType = "application/json"; Map<String, String> headers = constructHeaders(contentType, contentType); headers.put("Braintree-Version", Configuration.GRAPHQL_API_VERSION); try { connection = buildConnection(Http.RequestMethod.POST, configuration.getGraphQLURL(), headers); } catch (IOException e) { throw new UnexpectedException(e.getMessage(), e); } String jsonString = httpDo(Http.RequestMethod.POST, "/graphql", requestString, null, connection, headers, null); try { jsonMap = JSON.std.mapFrom(jsonString); } catch (IOException e) { throw new UnexpectedException(e.getMessage(), e); } throwExceptionIfGraphQLErrorResponse(jsonMap); return jsonMap; }
public Map<String, Object> query(String definition, Request request) { HttpURLConnection connection = null; Map<String, Object> jsonMap = null; Map<String, Object> variables = request != null ? request.toGraphQLVariables() : null; String requestString = formatGraphQLRequest(definition, variables); String contentType = "application/json"; Map<String, String> headers = constructHeaders(contentType, contentType); headers.put("Braintree-Version", Configuration.GRAPHQL_API_VERSION); try { connection = buildConnection(Http.RequestMethod.POST, configuration.getGraphQLURL(), headers); } catch (IOException e) { throw new UnexpectedException(e.getMessage(), e); } String jsonString = httpDo(Http.RequestMethod.POST, "/graphql", requestString, null, connection, headers, null); try { jsonMap = JSON.std.mapFrom(jsonString); } catch (IOException e) { throw new UnexpectedException(e.getMessage(), e); } throwExceptionIfGraphQLErrorResponse(jsonMap); return jsonMap; }
if (vcap != null) { try { Map<String, Object> envMap = JSON.std.mapFrom(vcap);
public Map<String, Object> query(String definition, Request request) { HttpURLConnection connection = null; Map<String, Object> jsonMap = null; Map<String, Object> variables = request != null ? request.toGraphQLVariables() : null; String requestString = formatGraphQLRequest(definition, variables); String contentType = "application/json"; Map<String, String> headers = constructHeaders(contentType, contentType); headers.put("Braintree-Version", Configuration.GRAPHQL_API_VERSION); try { connection = buildConnection(Http.RequestMethod.POST, configuration.getGraphQLURL(), headers); } catch (IOException e) { throw new UnexpectedException(e.getMessage(), e); } String jsonString = httpDo(Http.RequestMethod.POST, "/graphql", requestString, null, connection, headers, null); try { jsonMap = JSON.std.mapFrom(jsonString); } catch (IOException e) { throw new UnexpectedException(e.getMessage(), e); } throwExceptionIfGraphQLErrorResponse(jsonMap); return jsonMap; }