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


Java ObjectNode.toString方法代码示例

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


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

示例1: getJsonBufferPadded

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private ByteBuffer getJsonBufferPadded(ObjectNode jsonValue, int byteOffset) {
		if (jsonValue == null || jsonValue.size() == 0) {
			return ByteBuffer.allocate(0);
		}
		String jsonStr = jsonValue.toString();
		
		int boundary = 8;
		int byteLength = jsonStr.getBytes().length;
		int remainder = (byteOffset + byteLength) % boundary;
		int padding = (remainder == 0) ? 0 : boundary - remainder;
		
		ByteBuffer result = ByteBuffer.allocate(byteLength + padding);
		result.put(jsonStr.getBytes());
		for (int i = 0; i < padding; ++i) result.put((byte) 0x20);
//		String s = new String(result.array());
		return result;
	}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:18,代码来源:GlbToB3dmConvertor.java

示例2: jsonDashboard

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
/**
 * Returns the dashboard page data as JSON.
 *
 * @return dashboard page JSON data
 */
public synchronized String jsonDashboard() {
    log.info("jsonDashboard()");

    if (email == null) {
        return jsonLogout();
    }

    BundleDescriptor bundleDescriptor = currentBundle.descriptor();
    ObjectNode root = objectNode();
    root.put(BUNDLE_NAME, bundleDescriptor.displayName());
    root.put(BUNDLE_DESC, bundleDescriptor.description());
    root.set(USERS, userJsonArray());
    addSubId(root);
    return root.toString();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:CordModelCache.java

示例3: getResult

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的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

示例4: jsonFormat

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private String jsonFormat ( ObjectNode json ) {
	String result = json.toString();
	try {
		result = jacksonMapper.writerWithDefaultPrettyPrinter().writeValueAsString( json );
	} catch (JsonProcessingException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	return result;
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:12,代码来源:ServiceOsManager.java

示例5: basicBundleJson

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Test
public void basicBundleJson() {
    ObjectNode node = BundleFactory.toObjectNode(cache.getCurrentBundle());
    String json = node.toString();
    System.out.println(json);
    assertTrue("bad basic json", sameJson(BASIC_BUNDLE_JSON, json));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:CoreModelCacheTest.java

示例6: xml2json

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@RequestMapping("xml2json")
public String xml2json(
        @RequestParam("processDefinitionId") String processDefinitionId)
        throws Exception {
    RepositoryService repositoryService = processEngine
            .getRepositoryService();

    ProcessDefinition processDefinition = repositoryService
            .getProcessDefinition(processDefinitionId);

    Model model = repositoryService.newModel();
    model.setName(processDefinition.getName());
    model.setDeploymentId(processDefinition.getDeploymentId());
    repositoryService.saveModel(model);

    BpmnModel bpmnModel = repositoryService
            .getBpmnModel(processDefinitionId);
    ObjectNode objectNode = new BpmnJsonConverter()
            .convertToJson(bpmnModel);

    String json = objectNode.toString();

    repositoryService.addModelEditorSource(model.getId(),
            json.getBytes("utf-8"));

    return "redirect:/modeler/modeler-list.do";
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:28,代码来源:ModelerController.java

示例7: test_inline_template

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Test
public void test_inline_template() throws Exception {

    // Create the log event.
    SimpleMessage message = new SimpleMessage("Hello, World");
    String timestamp = "2017-09-28T17:13:29.098+02:00";
    long timeMillis = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").parse(timestamp).getTime();
    LogEvent logEvent = Log4jLogEvent
            .newBuilder()
            .setLoggerName(LogstashLayoutTest.class.getSimpleName())
            .setLevel(Level.INFO)
            .setMessage(message)
            .setTimeMillis(timeMillis)
            .build();

    // Create the template.
    ObjectNode templateRootNode = JSON_NODE_FACTORY.objectNode();
    templateRootNode.put("@timestamp", "${json:timestamp}");
    String staticFieldName = "staticFieldName";
    String staticFieldValue = "staticFieldValue";
    templateRootNode.put(staticFieldName, staticFieldValue);
    String template = templateRootNode.toString();

    // Create the layout.
    BuiltConfiguration configuration = ConfigurationBuilderFactory.newConfigurationBuilder().build();
    String timeZoneId = TimeZone.getTimeZone("Europe/Amsterdam").getID();
    LogstashLayout layout = LogstashLayout
            .newBuilder()
            .setConfiguration(configuration)
            .setTemplate(template)
            .setTimeZoneId(timeZoneId)
            .build();

    // Check the serialized event.
    String serializedLogEvent = layout.toSerializable(logEvent);
    JsonNode rootNode = OBJECT_MAPPER.readTree(serializedLogEvent);
    assertThat(point(rootNode, "@timestamp").asText()).isEqualTo(timestamp);
    assertThat(point(rootNode, staticFieldName).asText()).isEqualTo(staticFieldValue);

}
 
开发者ID:vy,项目名称:log4j2-logstash-layout,代码行数:41,代码来源:LogstashLayoutTest.java

示例8: test_property_injection

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Test
public void test_property_injection() throws Exception {

    // Create the log event.
    SimpleMessage message = new SimpleMessage("Hello, World");
    LogEvent logEvent = Log4jLogEvent
            .newBuilder()
            .setLoggerName(LogstashLayoutTest.class.getSimpleName())
            .setLevel(Level.INFO)
            .setMessage(message)
            .build();

    // Create the template with property.
    ObjectNode templateRootNode = JSON_NODE_FACTORY.objectNode();
    String propertyName = "propertyName";
    templateRootNode.put(propertyName, "${" + propertyName + "}");
    String template = templateRootNode.toString();

    // Create the layout with property.
    String propertyValue = "propertyValue";
    Configuration config = ConfigurationBuilderFactory
            .newConfigurationBuilder()
            .addProperty(propertyName, propertyValue)
            .build();
    LogstashLayout layout = LogstashLayout
            .newBuilder()
            .setConfiguration(config)
            .setTemplate(template)
            .build();

    // Check the serialized event.
    String serializedLogEvent = layout.toSerializable(logEvent);
    JsonNode rootNode = OBJECT_MAPPER.readTree(serializedLogEvent);
    assertThat(point(rootNode, propertyName).asText()).isEqualTo(propertyValue);

}
 
开发者ID:vy,项目名称:log4j2-logstash-layout,代码行数:37,代码来源:LogstashLayoutTest.java

示例9: toString

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的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

示例10: jsonUsers

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
/**
 * Returns the users page data as JSON.
 *
 * @return users page JSON data
 */
public synchronized String jsonUsers() {
    log.info("jsonUsers()");

    if (email == null) {
        return jsonLogout();
    }

    ObjectNode root = objectNode();
    root.set(USERS, userJsonArray());
    addSubId(root);
    return root.toString();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:CordModelCache.java

示例11: generateJson

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private String generateJson() {
    JsonNodeFactory nodeFactory = JsonNodeFactory.instance;

    ObjectNode json = (ObjectNode) contentConfig.toJson();
    json.set(JsonKeys.STORE_PACKAGE_IDENTIFIER, nodeFactory.textNode(storeIdentifier));

    return json.toString();
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:9,代码来源:ApplicationConfig.java

示例12: jsonBundle

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
/**
 * Returns the bundle page data as JSON.
 *
 * @return bundle page JSON data
 */
public synchronized String jsonBundle() {
    log.info("jsonBundle()");

    if (email == null) {
        return jsonLogout();
    }

    ObjectNode root = BundleFactory.toObjectNode(currentBundle);
    addSubId(root);
    return root.toString();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:CordModelCache.java

示例13: familyBundleJson

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Test
public void familyBundleJson() {
    cache.setCurrentBundle("family");
    ObjectNode node = BundleFactory.toObjectNode(cache.getCurrentBundle());
    String json = node.toString();
    System.out.println(json);
    assertTrue("bad family json", sameJson(FAMILY_BUNDLE_JSON, json));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:CoreModelCacheTest.java

示例14: userPreferences

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private InputStream userPreferences(String userName) {
    UiPreferencesService service = get(UiPreferencesService.class);
    ObjectNode prefs = mapper().createObjectNode();
    service.getPreferences(userName).forEach(prefs::set);
    String string = "var userPrefs = " + prefs.toString() + ";\n";
    return new ByteArrayInputStream(string.getBytes());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:MainIndexResource.java

示例15: allAsString

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public static String allAsString() {
	ObjectNode result = OBJECT_MAPPER.createObjectNode();
	result.put("includeAllFields", true);
	
	return result.toString();
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:7,代码来源:DefaultQueries.java


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