本文整理汇总了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 ;
}
示例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);
}
示例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;
}
示例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 );
}
示例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() ) ;
}
}
}
}