public void setMaxCampaignDuration(JsonObject maxCampaignDuration) { if (maxCampaignDuration != null) { this.maxCampaignDuration = maxCampaignDuration.toString(); } else { this.maxCampaignDuration = null; } }
public void setMinReachLimits(JsonObject minReachLimits) { if (minReachLimits != null) { this.minReachLimits = minReachLimits.toString(); } else { this.minReachLimits = null; } }
public void setPagePermissions(JsonObject pagePermissions) { if (pagePermissions != null) { this.pagePermissions = pagePermissions.toString(); } else { this.pagePermissions = null; } }
public void setTosAccepted(JsonObject tosAccepted) { if (tosAccepted != null) { this.tosAccepted = tosAccepted.toString(); } }
public void setMinCampaignDuration(JsonObject minCampaignDuration) { if (minCampaignDuration != null) { this.minCampaignDuration = minCampaignDuration.toString(); } else { this.minCampaignDuration = null; } }
public void setMaxDaysToFinish(JsonObject maxDaysToFinish) { if (maxDaysToFinish != null) { this.maxDaysToFinish = maxDaysToFinish.toString(); } else { this.maxDaysToFinish = null; } }
public void setAdaccountPermissions(JsonObject adaccountPermissions) { if (adaccountPermissions != null) { this.adaccountPermissions = adaccountPermissions.toString(); } else { this.adaccountPermissions = null; } }
/** * Make a prettyprinted JSON text of this JsonObject. * <p/> * Warning: This method assumes that the data structure is acyclical. * * @param indentFactor The number of spaces to add to each level of indentation. * @return a printable, displayable, portable, transmittable representation of * the object, beginning with <code>{</code> <small>(left * brace)</small> and ending with <code>}</code> <small>(right * brace)</small>. * @throws com.restfb.json.JsonException If the object contains an invalid number. */ public String toString(int indentFactor) throws JsonException { return toString(indentFactor, 0); }
/** * Given a map of query names to queries, verify that it contains valid data * and convert it to a JSON object string. * * @param queries The query map to convert. * @return The {@code queries} in JSON string format. * @throws IllegalArgumentException If the provided {@code queries} are invalid. */ protected String queriesToJson(Map<String, String> queries) { verifyParameterPresence("queries", queries); if (queries.keySet().size() == 0) throw new IllegalArgumentException("You must specify at least one query."); JsonObject jsonObject = new JsonObject(); for (Entry<String, String> entry : queries.entrySet()) { if (isBlank(entry.getKey()) || isBlank(entry.getValue())) throw new IllegalArgumentException("Provided queries must have non-blank keys and values. " + "You provided: " + queries); try { jsonObject.put(trimToEmpty(entry.getKey()), trimToEmpty(entry.getValue())); } catch (JsonException e) { // Shouldn't happen unless bizarre input is provided throw new IllegalArgumentException("Unable to convert " + queries + " to JSON.", e); } } return jsonObject.toString(); }
parametersWithAdditionalParameter(Parameter.with(IDS_PARAM_NAME, join(ids)), parameters))); return objectType.equals(JsonObject.class) ? (T) jsonObject : jsonMapper.toJavaObject(jsonObject.toString(), objectType); } catch (JsonException e) {
workaroundJsonObject.put("count", 0); workaroundJsonObject.put("data", new JsonArray()); rawValueAsString = workaroundJsonObject.toString();
return jsonMapper.toJavaObject(normalizedJson.toString(), resultType);
return new JsonObject((Map<?, ?>) value).toString();
workaroundJsonObject.add("total_count", 0); workaroundJsonObject.add("data", new JsonArray()); rawValueAsString = workaroundJsonObject.toString();
normalizedJson.toString(), objectType); } catch (JsonException e) { throw new FacebookJsonMappingException("Unable to process fql.multiquery JSON response", e);
/** * @see com.restfb.FacebookClient#debugToken(java.lang.String) */ @Override public DebugTokenInfo debugToken(String inputToken) { verifyParameterPresence("inputToken", inputToken); String response = makeRequest("/debug_token", Parameter.with("input_token", inputToken)); try { JsonObject json = Json.parse(response).asObject(); JsonObject data = json.get("data").asObject(); return getJsonMapper().toJavaObject(data.toString(), DebugTokenInfo.class); } catch (Exception t) { throw new FacebookResponseContentException("Unable to parse JSON from response.", t); } }
return mapper.toJavaObject(objValue.toString(), changeValueEnum.getValueClass()); } catch (IllegalArgumentException iae) { VALUE_FACTORY_LOGGER.warn("undefined change value detected: {}", classDefinition); VALUE_FACTORY_LOGGER.warn("please provide this information to the restfb team: {}", objValue.toString()); return new FallBackChangeValue(objValue);