當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。