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


Java JSONObject.toString方法代码示例

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


在下文中一共展示了JSONObject.toString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toJSON

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public String toJSON() {

		JSONObject projectObject = new JSONObject();
		projectObject.put("version", new JSONString(getVersion()));
		projectObject.put("title", new JSONString(getTitle()));
		projectObject.put("description", new JSONString(getDescription()));
		projectObject.put("date", new JSONString(getDate()));		
		
		JSONArray layersArray = new JSONArray();
		int index = 0;
		for(ProjectVectorLayer projectLayer: vectors) {
			layersArray.set(index, projectLayer.getJSONObject());
			
			index++;
		}
		
		projectObject.put("vectors", layersArray);

		return projectObject.toString();
	}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:21,代码来源:Project.java

示例2: getJsonObject

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
@Override
public String getJsonObject() {
	JSONObject config=new JSONObject();
	if(outputTables!=null) {
		config.put("outputTables", new JSONString(outputTables));
	}
	if(syncTables!=null) {
		config.put("syncTables", new JSONString(syncTables));
	}
	if(keepDays!=null) {
		config.put("keepDays", new JSONString(keepDays.toString()));
	}
	if(driftPercent!=null) {
		config.put("driftPercent", new JSONString(driftPercent.toString()));
	}
	JSONObject o=new JSONObject();
	o.put("id", new JSONString(HiveP.ID));
	o.put("config", config);
	return o.toString();
}
 
开发者ID:ctripcorp,项目名称:dataworks-zeus,代码行数:21,代码来源:ProcesserType.java

示例3: helloWorld

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
private void helloWorld() throws Exception {
  JSONObject sampleData = new JSONObject();
  sampleData.put("Field1", new JSONNumber(1.0));
  sampleData.put("Field2", new JSONString("Hello world"));
  sampleData.put("Field3", JSONBoolean.getInstance(true));

  // Sample 1 - basic usage
  final FormLayout formLayout = new FormLayout(sampleData.toString());
  RootPanel.get().add(formLayout);

  Button button = new Button("Apply");
  button.addStyleName(style.apply());
  button.addClickHandler(new ClickHandler() {

    @Override
    public void onClick(ClickEvent event) {
      Window.alert(formLayout.getDataJson());
    }
  });

  formLayout.appendWidgetToBottom(button);
}
 
开发者ID:hugzhorolo,项目名称:gwt-formlayout,代码行数:23,代码来源:App.java

示例4: generateDragComponentJSON

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public String generateDragComponentJSON(LayoutDragComponent dragComponent) {
    JSONObject jsonComponent = new JSONObject();
    extractBeanClass(dragComponent,
                     jsonComponent);
    if (dragComponent instanceof HasDragAndDropSettings) {
        JSONObject params = new JSONObject();

        HasDragAndDropSettings sComponent = (HasDragAndDropSettings) dragComponent;

        for (String key : sComponent.getSettingsKeys()) {
            String value = sComponent.getSettingValue(key);
            params.put(key,
                       new JSONString(value));
        }

        jsonComponent.put(COMPONENT_PARAMS,
                          params);
    }

    return jsonComponent.toString();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:22,代码来源:DndDataJSONConverter.java

示例5: getDataJson

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public String getDataJson() {
  JSONObject data = new JSONObject();
  for (String key : fieldOrder) {
    try {
      FormField field = getField(key);
      data.put(key, field.getJsonValue());
    } catch (Exception e) {
      ClientSideLogger.get().log(Level.WARNING, "exception: ", e);
    }
  }
  return data.toString();
}
 
开发者ID:hugzhorolo,项目名称:gwt-formlayout,代码行数:13,代码来源:FormLayout.java

示例6: getProperty

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
private static JSONValue getProperty(JSONObject obj, String propertyName) throws JSONException {
    JSONValue jsonValue = obj.get(propertyName);
    if (jsonValue == null) {
        throw new JSONException("Expected JSON Object with attribute " + propertyName + ": " + obj.toString());
    }
    return jsonValue;
}
 
开发者ID:ow2-proactive,项目名称:scheduling-portal,代码行数:8,代码来源:SchedulerJSONUtils.java

示例7: getLongValue

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
private static long getLongValue(JSONObject obj, String fieldName) throws JSONException {
    JSONValue jsonLongValue = obj.get(fieldName);
    if (jsonLongValue == null) {
        throw new JSONException("Expected JSON Object with attribute " + fieldName + ": " + obj.toString());
    }
    JSONNumber jsonLong = jsonLongValue.isNumber();
    if (jsonLong == null) {
        throw new JSONException("Expected JSON number: " + jsonLongValue.toString());
    }
    return (long) jsonLong.doubleValue();
}
 
开发者ID:ow2-proactive,项目名称:scheduling-portal,代码行数:12,代码来源:SchedulerJSONUtils.java

示例8: toJson

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public static String toJson(Map<String, String> map) {
  String json = "";
  if (map != null && !map.isEmpty()) {
    JSONObject jsonObj = new JSONObject();
    for (Map.Entry<String, String> entry : map.entrySet()) {
      jsonObj.put(entry.getKey(), new JSONString(entry.getValue()));
    }
    json = jsonObj.toString();
  }
  return json;
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:JsonHelper.java

示例9: yamlPreferencesToJson

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
/**
 * Convert YamlPreference's to JSON
 *
 * @param yamlPreferencesList
 * @return String of yamlPreferences
 */
private String yamlPreferencesToJson(List<YamlPreference> yamlPreferencesList) {
  Map<String, List<String>> schemaMap = PreferenceHelper.yamlPreferenceToMap(yamlPreferencesList);

  JSONObject jsonObj = new JSONObject();
  for (String glob : schemaMap.keySet()) {
    jsonObj.put(glob, prefListToJsonArray(schemaMap.get(glob)));
  }

  return jsonObj.toString();
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:YamlExtensionManagerPresenter.java

示例10: getToken

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
@Override
public String getToken(DigitalObjectCreatorPlace place) {
    JSONObject json = new JSONObject();
    JsonTokenizer.putString(json, MODEL, place.model);
    JsonTokenizer.putString(json, PARENT, place.parent);
    String jsonString = json.toString();
    return jsonString;
}
 
开发者ID:proarc,项目名称:proarc,代码行数:9,代码来源:DigitalObjectCreating.java

示例11: getToken

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
@Override
public String getToken(ImportPlace place) {
    JSONObject json = new JSONObject();
    Type importType = place.getType();
    JsonTokenizer.putString(json, TYPE, importType == null ? null : importType.name());
    JsonTokenizer.putString(json, BATCHID, place.getBatchId());
    return json.toString();
}
 
开发者ID:proarc,项目名称:proarc,代码行数:9,代码来源:Importing.java

示例12: toToken

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
@Override
public String toToken() {
    JSONObject json = new JSONObject();
    JsonTokenizer.putString(json, Tokenizer.TYPE, Type.JOBS.name());
    return json.toString();
}
 
开发者ID:proarc,项目名称:proarc,代码行数:7,代码来源:WorkflowManaging.java


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