当前位置: 首页>>代码示例>>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;未经允许,请勿转载。