/** * Construct a TimeZoneData javascript overlay object given some json text. * This method directly evaluates the String that you pass in; no error or * safety checking is performed, so be very careful about the source of * your data. * * @param json JSON text describing a time zone, like what comes from * {@link com.google.gwt.i18n.client.constants.TimeZoneConstants}. * @return a TimeZoneInfo object made from the supplied JSON. */ public static TimeZoneInfo buildTimeZoneData(String json) { return JsonUtils.safeEval(json); }
/** * Takes in a trusted JSON String and evals it. * * @param jsonString JSON string that you trust. * @return JavaScriptObject that you can cast to an Overlay Type */ public static JavaScriptObject eval(String jsonString) { return JsonUtils.safeEval(jsonString); }
/** * Construct a TimeZoneData javascript overlay object given some json text. * This method directly evaluates the String that you pass in; no error or * safety checking is performed, so be very careful about the source of * your data. * * @param json JSON text describing a time zone, like what comes from * {@link com.google.gwt.i18n.client.constants.TimeZoneConstants}. * @return a TimeZoneInfo object made from the supplied JSON. */ public static TimeZoneInfo buildTimeZoneData(String json) { return JsonUtils.safeEval(json); }
/** * Construct a TimeZoneData javascript overlay object given some json text. * This method directly evaluates the String that you pass in; no error or * safety checking is performed, so be very careful about the source of * your data. * * @param json JSON text describing a time zone, like what comes from * {@link com.google.gwt.i18n.client.constants.TimeZoneConstants}. * @return a TimeZoneInfo object made from the supplied JSON. */ public static TimeZoneInfo buildTimeZoneData(String json) { return JsonUtils.safeEval(json); }
public Properties parseJSON(String json) { return JsonUtils.safeEval(json); }
public JavaScriptObject convert(Object o) { if (o == null) { return null; } else if (o instanceof JavaScriptObject) { return (JavaScriptObject) o; } else { return JsonUtils.safeEval(o.toString()); } }
public JavaScriptObject convert(Object o) { if (o == null) { return null; } else if (o instanceof JavaScriptObject) { return (JavaScriptObject) o; } else { return JsonUtils.safeEval(o.toString()); } }
public static <T extends JSON> T parse(String jsonString) { return JsonUtils.safeEval(jsonString).cast(); }
public static <T extends JSON> T parse(String jsonString) { return JsonUtils.safeEval(jsonString).cast(); }
/** * Converts the given string to a range instance.<br> * <br> * Useful when using UiBinder. * * @param value * @return */ public static Range fromString(String value) { if (value == null || value.isEmpty()) return null; JsArrayNumber array = JsonUtils.safeEval(value); return new Range(array); }
protected <T extends JavaScriptObject> T eval(String response) { return USE_SAFE_EVAL ? JsonUtils.<T>safeEval(response) : JsonUtils.<T>unsafeEval(response); }
protected <T extends JavaScriptObject> T eval(String response) { return USE_SAFE_EVAL ? JsonUtils.<T>safeEval(response) : JsonUtils.<T>unsafeEval(response); }
/** * Converts the given string to a range instance.<br> * <br> * Useful when using UiBinder. * * @param value * @return */ public static Range fromString(String value) { if (value == null || value.isEmpty()) return null; JsArrayNumber array = JsonUtils.safeEval(value); return new Range(array); }
protected void eventListener(String origin, String request) { if (origin == null || !origin.endsWith("//" + opener)) { return; } ActionRequest actionRequest = JsonUtils.safeEval(request); if (ACTION_START_PROCESS.equals(actionRequest.getAction())) { startProcessFromDisplayer(); } }
public static Splittable split(String payload) { char c = payload.charAt(0); boolean isSimple = c != '{' && c != '['; if (isSimple) { payload = "[" + payload + "]"; } Splittable toReturn = JsonUtils.safeEval(payload).<JsoSplittable> cast(); if (isSimple) { toReturn = toReturn.get(0); } return toReturn; }
@Override public Object toNative() { if(GWT.isClient()) { return JsonUtils.safeEval(this.toJson()); } else { throw new UnsupportedOperationException("toNative not supported on the server"); } } }
/** * Performs evaluation of serialized response obeying the #useSafeEval configuration. * <p/> * * If #useSafeEval is {@code true} then the eval is performed using {@link JsonUtils#safeEval}, * otherwise then content will be loosely evaluated by {@link JsonUtils#unsafeEval}. * * @param response The serialized content * * @return The converted JavaScriptObject */ protected JavaScriptObject eval(String response) { return useSafeEval() ? JsonUtils.safeEval(response) : JsonUtils.unsafeEval(response); } }
/** * Performs evaluation of serialized response obeying the #useSafeEval configuration. * <p/> * * If #useSafeEval is {@code true} then the eval is performed using {@link JsonUtils#safeEval}, * otherwise then content will be loosely evaluated by {@link JsonUtils#unsafeEval}. * * @param response The serialized content * * @return The converted JavaScriptObject */ protected JavaScriptObject eval(String response) { return useSafeEval() ? JsonUtils.safeEval(response) : JsonUtils.unsafeEval(response); } }
protected void eventListener(String origin, String request) { if (origin == null || !origin.endsWith("//" + opener)) return; ActionRequest actionRequest = JsonUtils.safeEval(request); if (ACTION_CLAIM_TASK.equals(actionRequest.getAction())) claimFromDisplayer(); else if (ACTION_START_TASK.equals(actionRequest.getAction())) startFromDisplayer(); else if (ACTION_RELEASE_TASK.equals(actionRequest.getAction())) releaseFromDisplayer(); else if (ACTION_SAVE_TASK.equals(actionRequest.getAction())) saveStateFromDisplayer(); else if (ACTION_COMPLETE_TASK.equals(actionRequest.getAction())) completeFromDisplayer(); }
private List<String> getStringArrayAttribute(SliderOption option, List<String> defaultValue) { // Get array attribute JsArrayString array = null; if (isAttached()) { array = getStringArrayAttribute(getElement(), option.getName()); } else { String value = attributeMixin.getAttribute(option.getDataAttribute()); if (value != null && !value.isEmpty()) { array = JsonUtils.safeEval(value); } } // Attribute not set if (array == null) { return defaultValue; } // Put array to list List<String> list = new ArrayList<String>(array.length()); for (int i = 0; i < array.length(); i++) { list.add(array.get(i)); } return list; }