當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonNodeFactory.objectNode方法代碼示例

本文整理匯總了Java中com.fasterxml.jackson.databind.node.JsonNodeFactory.objectNode方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonNodeFactory.objectNode方法的具體用法?Java JsonNodeFactory.objectNode怎麽用?Java JsonNodeFactory.objectNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fasterxml.jackson.databind.node.JsonNodeFactory的用法示例。


在下文中一共展示了JsonNodeFactory.objectNode方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import com.fasterxml.jackson.databind.node.JsonNodeFactory; //導入方法依賴的package包/類
public static void main(String[] args) {
	GlbToB3dmConvertor convertor = new GlbToB3dmConvertor();
	JsonNodeFactory factory = new JsonNodeFactory(false);
	try {
		ObjectNode featureTableJsonNode = factory.objectNode();
		featureTableJsonNode.put("BATCH_LENGTH", 0);
		ByteBuffer glbBuffer = convertor.getBufferFromUri("", new File("D:\\tttt.glb").toPath());
		ByteBuffer b3dmBuffer = convertor.glbToB3dm(glbBuffer, featureTableJsonNode);
		OutputStream os = new FileOutputStream(new File("D:\\tttt.b3dm"));
		os.write(b3dmBuffer.array());
		os.flush();
		os.close();
	} catch (IOException e) {
		e.printStackTrace();
	}
	
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:18,代碼來源:GlbToB3dmConvertor.java

示例2: exportStatus

import com.fasterxml.jackson.databind.node.JsonNodeFactory; //導入方法依賴的package包/類
public boolean exportStatus(String outputFile) {
    Repository frozenRepository = this.repository.getSnapshotTo(this.repository.getRoot());

    File dumpFile = new File(outputFile);

    try(FileWriter fw = new FileWriter(dumpFile.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw)) {
        JsonNodeFactory jsonFactory = new JsonNodeFactory(false);
        ObjectNode mainNode = jsonFactory.objectNode();
        for (ByteArrayWrapper address : frozenRepository.getAccountsKeys()) {
            if(!address.equals(new ByteArrayWrapper(ZERO_BYTE_ARRAY))) {
                mainNode.set(Hex.toHexString(address.getData()), createAccountNode(mainNode, address.getData(), frozenRepository));
            }
        }
        ObjectMapper mapper = new ObjectMapper();
        ObjectWriter writer = mapper.writerWithDefaultPrettyPrinter();
        bw.write(writer.writeValueAsString(mainNode));
        return true;
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
        panicProcessor.panic("dumpstate", e.getMessage());
        return false;
    }
}
 
開發者ID:rsksmart,項目名稱:rskj,代碼行數:24,代碼來源:NetworkStateExporter.java

示例3: createDataNode

import com.fasterxml.jackson.databind.node.JsonNodeFactory; //導入方法依賴的package包/類
private static JsonNode createDataNode(Map<String, Object> data) {
    JsonNodeFactory factory = JsonNodeFactory.instance;
    ObjectNode dataNode = factory.objectNode();

    Set<Map.Entry<String, Object>> dataSet = data.entrySet();
    for (Map.Entry<String, Object> entry : dataSet) {
        Object value = entry.getValue();
        if (value == null) {
            continue;
        }

        dataNode.set(entry.getKey(), factory.textNode(value.toString()));
    }

    return dataNode;
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:17,代碼來源:PluginResultHelper.java

示例4: getResult

import com.fasterxml.jackson.databind.node.JsonNodeFactory; //導入方法依賴的package包/類
private static PluginResult getResult(String action, JsonNode data, JsonNode error) {
    JsonNodeFactory factory = JsonNodeFactory.instance;

    ObjectNode resultObject = factory.objectNode();
    if (action != null) {
        resultObject.set(JsParams.General.ACTION, factory.textNode(action));
    }

    if (data != null) {
        resultObject.set(JsParams.General.DATA, data);
    }

    if (error != null) {
        resultObject.set(JsParams.General.ERROR, error);
    }

    return new PluginResult(PluginResult.Status.OK, resultObject.toString());
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:19,代碼來源:PluginResultHelper.java

示例5: generateJson

import com.fasterxml.jackson.databind.node.JsonNodeFactory; //導入方法依賴的package包/類
private String generateJson() {
    final JsonNodeFactory nodeFactory = JsonNodeFactory.instance;
    ArrayNode filesListNode = nodeFactory.arrayNode();
    for (ManifestFile fileEntry : files) {
        ObjectNode fileNode = nodeFactory.objectNode();
        fileNode.set(JsonKeys.FILE_PATH, nodeFactory.textNode(fileEntry.name));
        fileNode.set(JsonKeys.FILE_HASH, nodeFactory.textNode(fileEntry.hash));
        filesListNode.add(fileNode);
    }

    return filesListNode.toString();
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:13,代碼來源:ContentManifest.java

示例6: toString

import com.fasterxml.jackson.databind.node.JsonNodeFactory; //導入方法依賴的package包/類
/**
 * Convert object into JSON string
 *
 * @return JSON string
 */
@Override
public String toString() {
    JsonNodeFactory nodeFactory = JsonNodeFactory.instance;
    ObjectNode object = nodeFactory.objectNode();
    object.set(APPLICATION_BUILD_VERSION, nodeFactory.numberNode(appBuildVersion));
    object.set(WWW_FOLDER_INSTALLED_FLAG, nodeFactory.booleanNode(wwwFolderInstalled));
    object.set(CURRENT_RELEASE_VERSION_NAME, nodeFactory.textNode(currentReleaseVersionName));
    object.set(PREVIOUS_RELEASE_VERSION_NAME, nodeFactory.textNode(previousReleaseVersionName));
    object.set(READY_FOR_INSTALLATION_RELEASE_VERSION_NAME, nodeFactory.textNode(readyForInstallationReleaseVersionName));

    return object.toString();
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:18,代碼來源:PluginInternalPreferences.java

示例7: shouldTryToLookupInJson

import com.fasterxml.jackson.databind.node.JsonNodeFactory; //導入方法依賴的package包/類
@Test
public void shouldTryToLookupInJson() {
    final JsonNodeFactory factory = JsonNodeFactory.instance;
    final ObjectNode obj = factory.objectNode();
    obj.set("a", factory.arrayNode().add("b").add("c"));
    obj.set("x", factory.objectNode().set("y", factory.objectNode().put("z", "!")));

    assertThat(ErrorMap.tryLookingUp(obj, "a")).contains("b");
    assertThat(ErrorMap.tryLookingUp(obj, "a", "b")).isEmpty();
    assertThat(ErrorMap.tryLookingUp(obj, "x", "y")).contains("{\"z\":\"!\"}");
    assertThat(ErrorMap.tryLookingUp(obj, "x", "y", "z")).contains("!");
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:13,代碼來源:ErrorMapTest.java

示例8: createErrorNode

import com.fasterxml.jackson.databind.node.JsonNodeFactory; //導入方法依賴的package包/類
private static JsonNode createErrorNode(int errorCode, String errorDescription) {
    JsonNodeFactory factory = JsonNodeFactory.instance;

    ObjectNode errorData = factory.objectNode();
    errorData.set(JsParams.Error.CODE, factory.numberNode(errorCode));
    errorData.set(JsParams.Error.DESCRIPTION, factory.textNode(errorDescription));

    return errorData;
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:10,代碼來源:PluginResultHelper.java

示例9: generateJson

import com.fasterxml.jackson.databind.node.JsonNodeFactory; //導入方法依賴的package包/類
private JsonNode generateJson() {
    JsonNodeFactory nodeFactory = JsonNodeFactory.instance;

    ObjectNode node = nodeFactory.objectNode();
    node.set(JsonKeys.CONTENT_URL, nodeFactory.textNode(contentUrl));
    node.set(JsonKeys.MINIMUM_NATIVE_VERSION, nodeFactory.numberNode(minimumNativeVersion));
    node.set(JsonKeys.VERSION, nodeFactory.textNode(releaseVersion));
    node.set(JsonKeys.UPDATE, nodeFactory.textNode(updateTime.toString()));

    return node;
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:12,代碼來源:ContentConfig.java


注:本文中的com.fasterxml.jackson.databind.node.JsonNodeFactory.objectNode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。