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


Java ObjectNode.size方法代码示例

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


在下文中一共展示了ObjectNode.size方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: health

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@CsapDoc ( notes = "Health of host" )
@RequestMapping ( "/health" )
public ObjectNode health ()
		throws Exception {

	ObjectNode healthJson = jacksonMapper.createObjectNode();

	ObjectNode errorNode = csapApp.buildErrorsForAdminOrAgent( ServiceAlertsEnum.ALERT_LEVEL );

	if ( errorNode.size() == 0 ) {
		healthJson.put( "Healthy", true );
	} else {

		healthJson.put( "Healthy", false );
		healthJson.set( "errors", errorNode );
	}

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

示例3: health

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@CsapDoc ( notes = "Summary of Application health" )
@RequestMapping ( "/health" )
public ObjectNode health ()
		throws Exception {

	ObjectNode healthJson = jacksonMapper.createObjectNode();

	ObjectNode errorNode = csapApp.buildErrorsForAdminOrAgent( ServiceAlertsEnum.ALERT_LEVEL );

	if ( errorNode.size() == 0 ) {
		healthJson.put( "Healthy", true );
	} else {

		healthJson.put( "Healthy", false );
		healthJson.set( "errors", errorNode );
	}

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

示例4: getComponentMeta

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private ObjectNode getComponentMeta(ClassLoader classLoader) {
    Properties properties = loadComponentProperties(classLoader);
    if (properties == null) {
        return null;
    }
    String components = (String) properties.get("components");
    if (components == null) {
        return null;
    }
    String[] part = components.split("\\s");
    ObjectNode componentMeta = new ObjectNode(JsonNodeFactory.instance);
    for (String scheme : part) {
        // find the class name
        String javaType = extractComponentJavaType(classLoader, scheme);
        if (javaType == null) {
            continue;
        }
        String schemeMeta = loadComponentJSonSchema(classLoader, scheme, javaType);
        if (schemeMeta == null) {
            continue;
        }
        componentMeta.set(scheme, new TextNode(schemeMeta));
    }
    return componentMeta.size() > 0 ? componentMeta : null;
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:26,代码来源:ExtractConnectorDescriptorsMojo.java

示例5: emanStatus

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@CsapDoc ( notes = {
		"Health Check for eman. Alert Level can be used to customize thresholds.",
		CsapDoc.INDENT + "A configured limit of 100, with alertLevel=1.5 will become 150"
} , produces = "plain/txt" )
@RequestMapping ( "/emanStatus" )
public String emanStatus (
							@RequestParam ( value = "alertLevel" , required = false , defaultValue = "1.0" ) double alertLevelForFiltering ) {

	logger.debug( "AlertLevel : {}", alertLevelForFiltering );
	String result = "Failure";
	try {
		// check vm connections
		ObjectNode errorNode = csapApp.buildErrorsForAdminOrAgent( alertLevelForFiltering );

		if ( errorNode.size() == 0 ) {
			result = "Success";
		} else {
			ObjectWriter writer = jacksonMapper.writerWithDefaultPrettyPrinter();
			result = "Failure\n" + writer.writeValueAsString( errorNode );
		}

	} catch (Exception e) {
		logger.error( "Failed: ", e );
	}

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

示例6: addConnectorMeta

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private void addConnectorMeta(ObjectNode root, ClassLoader classLoader) {
    ObjectNode node = new ObjectNode(JsonNodeFactory.instance);
    addOptionalNode(classLoader, node, "meta", "camel-connector.json");
    addOptionalSchemaAsString(classLoader, node, "schema", "camel-connector-schema.json");
    if (node.size() > 0) {
        root.set("connector", node);
    }
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:9,代码来源:ExtractConnectorDescriptorsMojo.java

示例7: addComponentMeta

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private void addComponentMeta(ObjectNode root, ClassLoader classLoader) {
    // is there any custom Camel components in this library?
    ObjectNode component = new ObjectNode(JsonNodeFactory.instance);

    ObjectNode componentMeta = getComponentMeta(classLoader);
    if (componentMeta != null) {
        component.set("meta", componentMeta);
    }
    addOptionalSchemaAsString(classLoader, component, "schema", "camel-component-schema.json");

    if (component.size() > 0) {
        root.set("component", component);
    }
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:15,代码来源:ExtractConnectorDescriptorsMojo.java

示例8: toJson

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public JsonNode toJson(SerializationOptions options) {
	ObjectNode obj = jsonObject();
	for (Entry<String, IJsonOverlay<V>> entry : overlays.entrySet()) {
		obj.set(entry.getKey(), entry.getValue().toJson(options.plus(Option.KEEP_ONE_EMPTY)));
	}
	return obj.size() > 0 || options.isKeepThisEmpty() ? obj : jsonMissing();
}
 
开发者ID:networknt,项目名称:openapi-parser,代码行数:9,代码来源:MapOverlay.java

示例9: execute

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public void execute() throws MojoExecutionException {
    try {
        JavaProjectBuilder builder = new JavaProjectBuilder();
        builder.addSourceTree(new File(srcDirectory, "src/main/java"));

        ObjectNode root = initializeRoot();
        ArrayNode tags = mapper.createArrayNode();
        ObjectNode paths = mapper.createObjectNode();
        ObjectNode definitions = mapper.createObjectNode();

        root.set("tags", tags);
        root.set("paths", paths);
        root.set("definitions", definitions);

        builder.getClasses().forEach(jc -> processClass(jc, paths, tags, definitions));

        if (paths.size() > 0) {
            getLog().info("Generating ONOS REST API documentation...");
            genCatalog(root);

            if (!isNullOrEmpty(apiPackage)) {
                genRegistrator();
            }
        }

        project.addCompileSourceRoot(new File(dstDirectory, GEN_SRC).getPath());

    } catch (Exception e) {
        getLog().warn("Unable to generate ONOS REST API documentation", e);
        throw e;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:34,代码来源:OnosSwaggerMojo.java

示例10: resolveObjectNode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private JsonNode resolveObjectNode(LogEvent event, JsonNode srcNode) {
    ObjectNode dstNode = objectMapper.createObjectNode();
    Iterator<Map.Entry<String, JsonNode>> srcNodeFieldIterator = srcNode.fields();
    while (srcNodeFieldIterator.hasNext()) {
        Map.Entry<String, JsonNode> srcNodeField = srcNodeFieldIterator.next();
        String key = srcNodeField.getKey();
        JsonNode value = srcNodeField.getValue();
        JsonNode resolvedValue = resolveNode(event, value);
        if (resolvedValue != null) {
            dstNode.set(key, resolvedValue);
        }
    }
    return dstNode.size() > 0 ? dstNode : null;
}
 
开发者ID:vy,项目名称:log4j2-logstash-layout,代码行数:15,代码来源:TemplateRenderer.java

示例11: statusForAdminOrAgent

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public ObjectNode statusForAdminOrAgent ( double alertLevel ) {

		ObjectNode healthJson = jacksonMapper.createObjectNode();
		ObjectNode errorNode = buildErrorsForAdminOrAgent( alertLevel );

		ObjectNode vmNode = healthJson.putObject( "vm" );

		if ( errorNode.size() == 0 ) {
			healthJson.put( "Healthy", true );
		} else {
			healthJson.put( "Healthy", false );
			healthJson.set( VALIDATION_ERRORS, errorNode );
		}

		ObjectNode serviceToRuntimeNode = getHostLoadCpuAndMore();
		;
		vmNode.put( "cpuCount", Integer.parseInt(
			serviceToRuntimeNode
				.path( "cpuCount" )
				.asText() ) );

		double newKB = Math.round( Double.parseDouble(
			serviceToRuntimeNode
				.path( "cpuLoad" )
				.asText() )
				* 10.0 )
				/ 10.0;

		vmNode.put( "cpuLoad", newKB );
		vmNode.put( "host", Application.getHOST_NAME() );
		vmNode.put( "packageName", getActiveModel().getReleasePackageName() );
		vmNode.put( "capabilityName", getName() );
		vmNode.put( "lifecycle", getCurrentLifeCycle() );

		int totalServicesActive = 0;
		int totalServices = 0;
		for ( ServiceInstance instance : getServicesOnHost() ) {

			if ( !instance.isScript() ) { // Scripts should be ignored
				totalServices++;
				if ( instance.isRunning() ) {
					totalServicesActive++;
				}
			}

		}

		ObjectNode serviceNode = healthJson.putObject( "services" );
		serviceNode.put( "total", totalServices );
		serviceNode.put( "active", totalServicesActive );

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

示例12: execute

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
@SuppressWarnings("PMD.EmptyCatchBlock")
public void execute() throws MojoExecutionException, MojoFailureException {

    ArrayNode root = new ArrayNode(JsonNodeFactory.instance);

    URLClassLoader classLoader = null;
    try {
        PluginDescriptor desc = (PluginDescriptor) getPluginContext().get("pluginDescriptor");
        List<Artifact> artifacts = desc.getArtifacts();
        ProjectBuildingRequest buildingRequest =
            new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
        buildingRequest.setRemoteRepositories(remoteRepositories);
        for (Artifact artifact : artifacts) {
            ArtifactResult result = artifactResolver.resolveArtifact(buildingRequest, artifact);
            File jar = result.getArtifact().getFile();
            classLoader = createClassLoader(jar);
            if (classLoader == null) {
                throw new IOException("Can not create classloader for " + jar);
            }
            ObjectNode entry = new ObjectNode(JsonNodeFactory.instance);
            addConnectorMeta(entry, classLoader);
                addComponentMeta(entry, classLoader);
            if (entry.size() > 0) {
                addGav(entry, artifact);
                root.add(entry);
            }
        }
        if (root.size() > 0) {
            saveCamelMetaData(root);
        }
    } catch (ArtifactResolverException | IOException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    } finally {
        if (classLoader != null) {
            try {
                classLoader.close();
            } catch (IOException ignored) {

            }
        }
    }
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:44,代码来源:ExtractConnectorDescriptorsMojo.java

示例13: requireMetadata

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private void requireMetadata() {
    final ObjectNode metadata = getMetadata();
    if (metadata == null || metadata.size() == 0) {
        throw new IllegalStateException("CREATE transaction cannot have empty metadata.");
    }
}
 
开发者ID:mgrand,项目名称:bigchaindb-java-driver,代码行数:7,代码来源:UnsignedCreateTransactionImpl.java


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