当前位置: 首页>>代码示例>>Java>>正文


Java JSONValue类代码示例

本文整理汇总了Java中com.google.gwt.json.client.JSONValue的典型用法代码示例。如果您正苦于以下问题:Java JSONValue类的具体用法?Java JSONValue怎么用?Java JSONValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JSONValue类属于com.google.gwt.json.client包,在下文中一共展示了JSONValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
public IFlowRequest create(JSONArray state, Integer initialItemIndex) {
    IFlowRequest flowRequest = null;

    if (initialItemIndex != null) {
        flowRequest = new FlowRequest.NavigateGotoItem(initialItemIndex);
    } else if (state != null) {

        JSONValue firstState = state.get(0);
        if (firstState.isNumber() != null) {
            flowRequest = getFlowRequestFromNumber(firstState);
        } else if (firstState.isString() != null) {
            flowRequest = getFlowRequestFromString(firstState);
        }
    }
    return flowRequest;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:17,代码来源:FlowRequestFactory.java

示例2: toJSON

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
@Override
public JSONValue toJSON() {
    JSONArray jsonArr = new JSONArray();
    jsonArr.set(0, new JSONString(OUTCOME));
    jsonArr.set(1, new JSONString(identifier));
    jsonArr.set(2, new JSONString(cardinality.toString()));
    jsonArr.set(3, new JSONString(""));

    JSONArray valuesArr = new JSONArray();
    for (int v = 0; v < values.size(); v++) {
        valuesArr.set(v, new JSONString(values.get(v)));
    }
    jsonArr.set(4, valuesArr);
    jsonArr.set(5, new JSONString(interpretation));
    jsonArr.set(6, new JSONNumber(normalMaximum));

    return jsonArr;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:Outcome.java

示例3: fromJSON

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
@Override
public void fromJSON(JSONValue value) {
    JSONArray jsonArr = value.isArray();

    if (jsonArr != null) {
        identifier = jsonArr.get(1).isString().stringValue();
        cardinality = Cardinality.valueOf(jsonArr.get(2).isString().stringValue());

        JSONArray jsonValues = jsonArr.get(4).isArray();
        values.clear();
        if (jsonValues != null) {
            for (int i = 0; i < jsonValues.size(); i++) {
                values.add(jsonValues.get(i).isString().stringValue());
            }
        }

        interpretation = jsonArr.get(5).isString().stringValue();
        normalMaximum = jsonArr.get(6).isNumber().doubleValue();
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:21,代码来源:Outcome.java

示例4: fromJSON

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void fromJSON(JSONValue json) {
    JSONArray jsonArr = json.isArray();

    if (jsonArr != null) {
        for (int i = 0; i < jsonArr.size(); i++) {
            if (!(jsonArr.get(0) instanceof JSONNull) && !(jsonArr.get(i).isArray().get(0) instanceof JSONNull)) {
                String type = jsonArr.get(i).isArray().get(0).isString().stringValue();
                if (type.equals(Outcome.OLD_OUTCOME) || type.equals(Outcome.OUTCOME)) {
                    Outcome o = new Outcome();
                    o.fromJSON(jsonArr.get(i));
                    variables.put(o.identifier, o);
                }
            }
        }
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:ItemOutcomeStorageImpl.java

示例5: toList

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
public List<String> toList(String jsonStr) {

    JSONValue parsed = JSONParser.parseStrict(jsonStr);
    JSONArray jsonArray = parsed.isArray();

    if (jsonArray == null) {
      return Collections.emptyList();
    }

    List<String> list = new ArrayList<>();
    for (int i = 0; i < jsonArray.size(); i++) {
      JSONValue jsonValue = jsonArray.get(i);
      JSONString jsonString = jsonValue.isString();
      String stringValue = (jsonString == null) ? jsonValue.toString() : jsonString.stringValue();
      list.add(stringValue);
    }

    return list;
  }
 
开发者ID:eclipse,项目名称:che-archetypes,代码行数:20,代码来源:StringListUnmarshaller.java

示例6: getStyle

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
public static ProjectLayerStyle getStyle(String geoJSONCSS) {
	ProjectLayerStyle style = null;
	final JSONValue jsonValue = JSONParser.parseLenient(geoJSONCSS);
	final JSONObject geoJSONCssObject = jsonValue.isObject();

	if (geoJSONCssObject.containsKey(GeoJSONCSS.STYLE_NAME)) {

		JSONObject styleObject = geoJSONCssObject
				.get(GeoJSONCSS.STYLE_NAME).isObject();

		String fillColor = getStringValue(styleObject, FILL_COLOR_NAME);
		Double fillOpacity = getDoubleValue(styleObject, FILL_OPACITY_NAME);
		if(fillOpacity == null) {
			fillOpacity = getDoubleValue(styleObject, FILL_OPACITY2_NAME);				
		}
		String strokeColor = getStringValue(styleObject, STROKE_COLOR_NAME);
		Double strokeWidth = getDoubleValue(styleObject, STROKE_WIDTH_NAME);

		style = new ProjectLayerStyle(fillColor, fillOpacity, strokeColor,
				strokeWidth);
	}

	return style;
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:25,代码来源:LeafletStyle.java

示例7: extractFormName

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
private static String extractFormName(RpcResult result) {
  String extraString = result.getExtra();
  if (extraString != null) {
    JSONValue extraJSONValue = JSONParser.parseStrict(extraString);
    JSONObject extraJSONObject = extraJSONValue.isObject();
    if (extraJSONObject != null) {
      JSONValue formNameJSONValue = extraJSONObject.get("formName");
      if (formNameJSONValue != null) {
        JSONString formNameJSONString = formNameJSONValue.isString();
        if (formNameJSONString != null) {
          return formNameJSONString.stringValue();
        }
      }
    }
  }
  return "Screen1";
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:18,代码来源:WaitForBuildResultCommand.java

示例8: setOption

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
private void setOption(JSONObject rootObject, String path, Object value) {
  if (path == null) {
    return;
  }
  if (path.startsWith("/")) {
    path = path.substring(1);
  }
  if (path.length() <= 0) {
    return;
  }
  String nodeName = path;
  if (nodeName.contains("/")) {
    nodeName = nodeName.substring(0, nodeName.indexOf("/"));
    JSONValue objectAsValue = rootObject.get(nodeName);
    if (objectAsValue == null || objectAsValue.isObject() == null) {
      rootObject.put(nodeName, new JSONObject());
    }
    JSONObject object = (JSONObject) rootObject.get(nodeName);
    setOption(object, path.substring(path.indexOf("/") + 1), value);
  } else {
    rootObject.put(nodeName, convertToJSONValue(value));
  }
}
 
开发者ID:jiakuan,项目名称:gwt-uploader,代码行数:24,代码来源:Configurable.java

示例9: parseDefaultValues

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
/**
 * Extracts default preference values from the gadget metadata JSON object
 * returned from GGS.
 *
 * @param prefs the preference JSON object received from GGS.
 */
public void parseDefaultValues(JSONObject prefs) {
  if (prefs != null) {
    for (String pref : prefs.keySet()) {
      if (!has(pref)) {
        JSONObject prefJson = prefs.get(pref).isObject();
        if (prefJson != null) {
          JSONValue value = prefJson.get("default");
          if ((value != null) && (value.isString() != null)) {
            put(pref, value.isString().stringValue());
            log("Gadget pref '" + pref + "' = '" + get(pref) + "'");
          }
        } else {
          log("Invalid pref '" + pref + "' value in Gadget metadata.");
        }
      }
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:25,代码来源:GadgetUserPrefs.java

示例10: parseGadgetInfoJson

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
@Override
public List<GadgetInfo> parseGadgetInfoJson(String json) {
  List<GadgetInfo> gadgetList = new ArrayList<GadgetInfo>();
  JSONValue value = JSONParser.parseStrict(json);
  JSONArray array = value.isArray();
  if (array != null) {
    for (int i = 0; i < array.size(); i++) {
      JSONValue item = array.get(i);
      GadgetInfo info = parseGadgetInfo(item);
      if (info != null) {
        gadgetList.add(info);
      }
    }
  }
  return gadgetList;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:17,代码来源:GwtGadgetInfoParser.java

示例11: parseGadgetInfo

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
private GadgetInfo parseGadgetInfo(JSONValue item) {
  JSONObject object = item.isObject();
  if (object != null) {
    String name = object.get("name").isString().stringValue();
    String desc = object.get("desc").isString().stringValue();
    GadgetCategoryType primaryCategory =
        GadgetCategoryType.of(object.get("primaryCategory").isString().stringValue());
    GadgetCategoryType secondaryCategory =
        GadgetCategoryType.of(object.get("secondaryCategory").isString().stringValue());
    String gadgetUrl = object.get("gadgetUrl").isString().stringValue();
    String author = object.get("author").isString().stringValue();
    String submittedBy = object.get("submittedBy").isString().stringValue();
    String imageUrl = object.get("imageUrl").isString().stringValue();

    return new GadgetInfo(name, desc, primaryCategory, secondaryCategory, gadgetUrl, author,
        submittedBy, imageUrl);
  }
  return null;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:20,代码来源:GwtGadgetInfoParser.java

示例12: parseMap

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
public static <T extends Enum<T>> Map<T, Double> parseMap(Class<T> clazz,
		String text) {
	
	if (text == null) {
		return new TreeMap<T, Double>();
	} else {
	
		JSONValue v = JSONParser.parseLenient(text);
		Map<String, String> smap = JsonUtil.parseMap(v);

		Map<T, Double> map = new TreeMap<T, Double>();

		for (Map.Entry<String, String> e : smap.entrySet()) {
			T type = Enum.valueOf(clazz, e.getKey());
			Double d = Double.parseDouble(e.getValue());
			
			map.put(type, d);
		}

		return map;
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:23,代码来源:JsonUtil.java

示例13: updateVariables

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
private void updateVariables(JSONValue updatedVariablesJsonValue) {
    JSONObject obj = updatedVariablesJsonValue.isObject();
    if (obj != null) {
        for (String varName : obj.keySet()) {
            JobVariable variable = variables.get(varName);
            if (variable != null) {
                JSONValue variableJsonValue = obj.get(varName);
                JSONString variableJsonString = variableJsonValue.isString();
                if (variableJsonString != null) {
                    variable.setValue(variableJsonString.stringValue());
                }

            }
        }
    }
}
 
开发者ID:ow2-proactive,项目名称:scheduling-portal,代码行数:17,代码来源:SubmitWindow.java

示例14: deleteItem

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
@Override
protected void deleteItem(final ListGridRecord rollOverRecord) {
	SC.ask(constants.deleteThisRun().replace("***", rollOverRecord.getAttributeAsString(RunModel.RUNTITLE_FIELD)), new BooleanCallback() {
		public void execute(Boolean value) {
			if (value != null && value) {
				RunClient.getInstance().deleteItemsForRun(rollOverRecord.getAttributeAsLong("runId"), new JsonCallback() {
					
					@Override
					public void onJsonReceived(JSONValue jsonValue) {
						
						RunDataSource.getInstance().loadDataFromWeb();
	
					}
				});	
				
			}
		}
	});	
}
 
开发者ID:WELTEN,项目名称:dojo-ibl,代码行数:20,代码来源:RunsTab.java

示例15: deserialize

import com.google.gwt.json.client.JSONValue; //导入依赖的package包/类
@Override
public Object deserialize(String payload, Type expected)
    throws SerializerException {

    JSONValue jsonValue = JSONParser.parseStrict(payload);

    try {
        Object object = fromJSONValue(jsonValue, expected);

        if (object == null) {
            throw new SerializerException(
                SerializerException.Error.NOT_DESERIALIZABLE);
        }

        return object;

    } catch (NoSuitableSerializableFactory exception) {
        throw new SerializerException(
            SerializerException.Error.NOT_DESERIALIZABLE, exception);
    }
}
 
开发者ID:snogaraleal,项目名称:wbi,代码行数:22,代码来源:JSONSerializer.java


注:本文中的com.google.gwt.json.client.JSONValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。