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


Java ArrayNode.addAll方法代碼示例

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


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

示例1: allAdminUsers

import com.fasterxml.jackson.databind.node.ArrayNode; //導入方法依賴的package包/類
@Cacheable(CsapCoreService.TIMEOUT_CACHE_60s)
synchronized public ArrayNode allAdminUsers () {

	ArrayNode users = jacksonMapper.createArrayNode() ;
	
	
	// remove calls for other hosts
	csapApp.getAllPackages()
		.getServiceInstances( "admin" )
		.filter( instance -> ! instance.getHostName().equals( Application.getHOST_NAME() ) )
		.map( this::getUsersOnRemoteAdmins )
		.forEach( users::addAll );
	
	// add the local host entries
	users.addAll( getActive() ) ;
	
	// now make them distinct
	HashSet<String> uniqueUsers = new HashSet<>() ;
	users.forEach( userJson -> uniqueUsers.add( userJson.asText() ));
	
	// Now transform 
	users.removeAll() ;
	uniqueUsers.forEach( users::add );

	
	return users ;
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:28,代碼來源:ActiveUsers.java

示例2: getProductReferenceSetAttributeDraft

import com.fasterxml.jackson.databind.node.ArrayNode; //導入方法依賴的package包/類
/**
 * Creates an {@link AttributeDraft} with the supplied {@code attributeName} and {@code references}.
 * @param attributeName the name to set on the {@link AttributeDraft}.
 * @param references the references to set on the {@link AttributeDraft}.
 * @return an {@link AttributeDraft} with the supplied {@code attributeName} and {@code references}.
 */
@Nonnull
public static AttributeDraft getProductReferenceSetAttributeDraft(@Nonnull final String attributeName,
                                                                  @Nonnull final ObjectNode... references) {
    final ArrayNode referenceSet = JsonNodeFactory.instance.arrayNode();
    referenceSet.addAll(Arrays.asList(references));
    return AttributeDraft.of(attributeName, referenceSet);
}
 
開發者ID:commercetools,項目名稱:commercetools-sync-java,代碼行數:14,代碼來源:ProductSyncMockUtils.java

示例3: getAllAlerts

import com.fasterxml.jackson.databind.node.ArrayNode; //導入方法依賴的package包/類
public ArrayNode getAllAlerts () {
	ArrayNode all = jsonMapper.createArrayNode();
	all.addAll( getAlertHistory() );
	all.addAll( getAlertsThrottled() );
	return all;
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:7,代碼來源:HostStatusManager.java

示例4: buildJmxReports

import com.fasterxml.jackson.databind.node.ArrayNode; //導入方法依賴的package包/類
public void buildJmxReports (	boolean isUpdateSummary, int requestedSampleSize, List<String> servicesFilter,
								ObjectNode dataNode, int numSamples ) {
	ObjectNode currSummary = jacksonMapper.createObjectNode();
	// standard JMX collections
	for ( String serviceName : servicesFilter ) {
		ObjectNode serviceCacheNode = jmxResultsCache
			.get( serviceName );
		if ( serviceCacheNode != null ) {

			String sumName = serviceName;
			int index = sumName.indexOf( "_" );
			if ( index != -1 ) {
				sumName = sumName.substring( 0, index );
			}
			ObjectNode serviceSummaryJson = currSummary.putObject( sumName );
			serviceSummaryJson.put( "numberOfSamples", numSamples );
			for ( JmxCommonEnum jmxMetric : JmxCommonEnum.values() ) {

				String metricFullName = jmxMetric.value + "_"
						+ serviceName;
				ArrayNode cacheArray = (ArrayNode) serviceCacheNode
					.get( metricFullName );

				if ( cacheArray == null ) {
					continue;
				}

				ArrayNode metricArray = dataNode
					.putArray( metricFullName );
				if ( requestedSampleSize == -1 ) {
					metricArray.addAll( cacheArray );
				} else {
					long metricTotal = 0;
					for ( int i = 0; i < requestedSampleSize
							&& i < cacheArray.size(); i++ ) {
						metricArray.add( cacheArray.get( i ) );
						metricTotal += cacheArray
							.get( i )
							.asLong();
					}
					serviceSummaryJson.put( jmxMetric.value, metricTotal );
				}
			}
		}
	}

	addSummary( currSummary, isUpdateSummary );
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:49,代碼來源:ServiceCollector.java

示例5: buildApplicationReports

import com.fasterxml.jackson.databind.node.ArrayNode; //導入方法依賴的package包/類
public void buildApplicationReports (	boolean isUpdateSummary, int requestedSampleSize, List<String> servicesFilter,
										ObjectNode dataNode,
										int numSamples ) {
	// custom Collections
	String serviceName = servicesFilter.get( 0 );
	ObjectNode serviceCacheNode = customResultsCache
		.get( serviceName );

	String sumName = serviceName;
	int index = sumName.indexOf( "_" );
	if ( index != -1 ) {
		sumName = sumName.substring( 0, index );
	}

	//
	ObjectNode serviceSummaryJson = jacksonMapper.createObjectNode();
	if ( isUpdateSummary ) {
		// Done on a single thread
		serviceSummaryJson = _lastCustomServiceSummary.putObject( sumName );
	}

	serviceSummaryJson.put( "numberOfSamples", numSamples );

	if ( serviceCacheNode == null ) {

		logger.debug( "Warning: serviceCacheNode is null" );

	} else {

		// logger.info("**** serviceName " + serviceName);
		for ( Iterator<String> metricIdIterator = serviceCacheNode
			.fieldNames(); metricIdIterator.hasNext(); ) {

			String metricId = metricIdIterator
				.next()
				.trim();

			logger.debug( "metricId: {}", metricId );

			ArrayNode metricCacheArray = (ArrayNode) serviceCacheNode
				.get( metricId );

			ArrayNode metricResultsArray = dataNode.putArray( metricId );

			//
			if ( requestedSampleSize == -1 ) {
				metricResultsArray.addAll( metricCacheArray );
			} else {

				// summary reports as ints? maybe switch to doubles
				//
				// logger.info( "metricCacheArray size: " +
				// metricCacheArray.size() ) ;
				long metricTotal = 0;
				for ( int i = 0; i < requestedSampleSize
						&& i < metricCacheArray.size(); i++ ) {

					metricResultsArray.add( metricCacheArray.get( i ) );
					long current = metricCacheArray
						.get( i )
						.asLong();
					metricTotal += current;
				}
				serviceSummaryJson.put( metricId, metricTotal );
				logger.debug( "{}  total: {} ", metricId, metricTotal );
				// logger.info("Type: " +
				// serviceSummaryJson.get(metricId).getNodeType() ) ;
			}

		}
	}
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:73,代碼來源:ServiceCollector.java


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