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


Java MapUtils.isEmpty方法代码示例

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


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

示例1: createEventParams

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/**
 * 创建Webhook事件参数
 *
 * @param webhookId
 * @param eventType
 * @param paramMap
 * @return
 */
public List<WebhookEventParam> createEventParams(int webhookId, int eventType, Map<String, String> paramMap) {
    if (MapUtils.isEmpty(paramMap)) {
        return Collections.emptyList();
    }

    List<WebhookEventParam> webhookEventParams = new ArrayList<>();
    WebhookEventParam webhookEventParam = null;
    for (Map.Entry<String, String> entry : paramMap.entrySet()) {
        webhookEventParam = newWebhookEventParam(webhookId, eventType, entry.getKey(), entry.getValue());
        webhookEventParams.add(webhookEventParam);
    }
    if (CollectionUtils.isNotEmpty(webhookEventParams)) {
        eventParamMapper.batchInsert(webhookEventParams);
    }
    return webhookEventParams;
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:25,代码来源:HookStoreService.java

示例2: createRequestParams

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/**
 * 创建Webhook请求参数
 *
 * @param webhookId
 * @param paramMap
 * @return
 */
public List<WebhookRequestParam> createRequestParams(int webhookId, Map<String, String> paramMap) {
    if (MapUtils.isEmpty(paramMap)) {
        return Collections.emptyList();
    }

    List<WebhookRequestParam> webhookRequestParams = new ArrayList<>();
    WebhookRequestParam webhookRequestParam = null;
    for (Map.Entry<String, String> entry : paramMap.entrySet()) {
        webhookRequestParam = newWebhookRequestParam(webhookId, entry.getKey(), entry.getValue());
        webhookRequestParams.add(webhookRequestParam);
    }
    if (CollectionUtils.isNotEmpty(webhookRequestParams)) {
        webhookRequestParamMapper.batchInsert(webhookRequestParams);
    }
    return webhookRequestParams;
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:24,代码来源:HookStoreService.java

示例3: extractServiceMetaData

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
private Map<String, Object> extractServiceMetaData(RouteVM routeVM) {
    Objects.requireNonNull(routeVM,
        "Can't extract service metadata because routeVM is not pass");

    Map<String, String> serviceInstancesStatus = routeVM.getServiceInstancesStatus();
    if (MapUtils.isEmpty(serviceInstancesStatus)) {
        log.error("Microservice instances has no statuses");
        return null;
    }
    Map<String, Object> result = null;
    for (ServiceInstance instance : routeVM.getServiceInstances()) {
        if (instance.getUri() == null || StringUtils.isBlank(instance.getUri().toString())) {
            continue;
        }
        String uri = instance.getUri().toString();
        if ("UP".equals(serviceInstancesStatus.get(uri))) {
            if (result == null) {
                result = new HashMap<>();
            }
            result.put(uri, getInstanceInfo(uri));
        }
    }
    return result;
}
 
开发者ID:xm-online,项目名称:xm-gate,代码行数:25,代码来源:GatewayResource.java

示例4: afterPropertiesSet

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {

    //获取服务注册中心
    IRegisterCenter4Invoker registerCenter4Consumer = ZKRegisterCenter.singleton();
    //初始化服务提供者列表到本地缓存
    registerCenter4Consumer.initProviderMap(remoteAppKey, groupName);

    //初始化Netty Channel,providerMap提供几个服务接口就是几个
    Map<String, List<ProviderService>> providerMap = registerCenter4Consumer.getServiceMetaDataMap4Consume();
    if (MapUtils.isEmpty(providerMap)) {
        throw new RuntimeException("service provider list is empty.");
    }
    NettyChannelPoolFactory.channelPoolFactoryInstance().initChannelPoolFactory(providerMap);

    //获取服务提供者代理对象
    RevokerProxyBeanFactory proxyFactory = RevokerProxyBeanFactory.singleton(targetInterface, timeout, clusterStrategy);
    this.serviceObject = proxyFactory.getProxy();

    //将消费者信息注册到注册中心
    InvokerService invoker = new InvokerService();
    invoker.setServiceItf(targetInterface);
    invoker.setRemoteAppKey(remoteAppKey);
    invoker.setGroupName(groupName);
    registerCenter4Consumer.registerInvoker(invoker);
}
 
开发者ID:linuer,项目名称:nan,代码行数:27,代码来源:RevokerFactoryBean.java

示例5: getBeanMap

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
@SuppressWarnings({"rawtypes", "unchecked"})
private Map<Object, Object> getBeanMap(Object obj) throws Exception {
    Map oMap = new BeanMap(obj);
    Map rMap = new HashMap();
    if (MapUtils.isEmpty(oMap)) {
        throw new Exception("实体类没有可用属性");
    } else {
        // 去除class属性
        for (Object key : oMap.keySet()) {
            if (!"class".equals(key)) {
                rMap.put(key, oMap.get(key));
            }
        }
    }
    return rMap;
}
 
开发者ID:phoenix-varus,项目名称:jeeWe,代码行数:17,代码来源:BaseProvider.java

示例6: registerBeans

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/**
 * 注册,可以对beanName进行修改
 *
 * @param beanDefinitions BeanDefinition的map集合(key为beanName, value为BeanDefinition)
 * @param registry        spring注册Bean的对象
 */
public static void registerBeans(Map<String, BeanDefinition> beanDefinitions, BeanDefinitionRegistry registry, BeanNameBuilder builder) {
    if (MapUtils.isEmpty(beanDefinitions)) {
        return;
    }

    if (registry == null) {
        return;
    }

    Set<String> beanNames = beanDefinitions.keySet();
    for (String beanName : beanNames) {
        BeanDefinition bean = beanDefinitions.get(beanName);
        beanName = builder.buildBeanName(beanName, bean);
        if (registry.containsBeanDefinition(beanName)) {
            continue;
        }

        registry.registerBeanDefinition(beanName, bean);
    }
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:27,代码来源:BeanRegisterUtils.java

示例7: podRequestsCNI

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
private static boolean podRequestsCNI(PodSpec podSpec) {
    // if we don't have a cluster that supports CNI port mapping make sure that we don't either (1) specify
    // any networks and/ (2) if we are make sure we didn't explicitly do any port mapping or that
    // any of the tasks ask for ports (which will automatically be forwarded, this requiring port mapping).
    for (NetworkSpec networkSpec : podSpec.getNetworks()) {
        if (!MapUtils.isEmpty(networkSpec.getPortMappings())) {
            return true;
        }
    }

    for (TaskSpec taskSpec : podSpec.getTasks()) {
        for (ResourceSpec resourceSpec : taskSpec.getResourceSet().getResources()) {
            if (resourceSpec.getName().equals("ports")) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:20,代码来源:PodSpecsCannotUseUnsupportedFeatures.java

示例8: policyExists

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
private boolean policyExists( String policyId )
{
    if ( MapUtils.isEmpty( prePolicies ) )
    {
        log.error( "No PreDownloadPolicies found!" );
        return false;
    }

    if ( MapUtils.isEmpty( postPolicies ) )
    {
        log.error( "No PostDownloadPolicies found!" );
        return false;
    }

    return ( prePolicies.containsKey( policyId ) || postPolicies.containsKey( policyId )
        || downloadErrorPolicies.containsKey( policyId ) );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:18,代码来源:DefaultArchivaConfiguration.java

示例9: getServiceProviderMappedUserRoles

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/**
 * @param applicationConfig
 * @param locallyMappedUserRoles
 * @return
 */
private static String getServiceProviderMappedUserRoles(ApplicationConfig applicationConfig,
                                                        List<String> locallyMappedUserRoles, String claimSeparator)
        throws FrameworkException {

    Map<String, String> localToSpRoleMapping = applicationConfig.getRoleMappings();

    if (!MapUtils.isEmpty(localToSpRoleMapping)) {
        for (Map.Entry<String, String> roleMapping : localToSpRoleMapping.entrySet()) {
            if (locallyMappedUserRoles.contains(roleMapping.getKey())) {
                locallyMappedUserRoles.remove(roleMapping.getKey());
                locallyMappedUserRoles.add(roleMapping.getValue());
            }
        }
    }

    return StringUtils.join(locallyMappedUserRoles, claimSeparator);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:23,代码来源:DefaultClaimHandler.java

示例10: setEnv

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
private void setEnv() {
    if (CollectionUtils.isNotEmpty(config.getEnv())) {
        Map<String, Object> envsToAdd = new HashMap<>(config.getEnv().size());
        for (MarathonVars var : config.getEnv()) {
            envsToAdd.put(
                    Util.replaceMacro(var.getName(), envVars),
                    Util.replaceMacro(var.getValue(), envVars));
        }

        if (MapUtils.isEmpty(getApp().getEnv())) {
            getApp().setEnv(envsToAdd);
        } else {
            getApp().getEnv().putAll(envsToAdd);
        }
    }
}
 
开发者ID:jenkinsci,项目名称:marathon-plugin,代码行数:17,代码来源:MarathonBuilderImpl.java

示例11: convertPropertiesToMap

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
public static void convertPropertiesToMap(Map<String, String> results, Properties properties) {
    if(results == null) {
        LOGGER.error("params:[results] is null");
        return;
    }
    if(MapUtils.isEmpty(properties)) {
        LOGGER.error(("params:[properties] is empty"));
        return;
    }
    Iterator<?> iterator = properties.keySet().iterator();
    String key = null;
    String value = null;
    while(iterator.hasNext()) {
        key = iterator.next().toString();
        if(key.startsWith(COMMENT_PREFIX)) {
            // 注释的属性不加载
            continue;
        }
        value = properties.getProperty(key);
        if(StringUtils.isBlank(value)) {
            LOGGER.error(String.format("properties file has valid value, key[%s]", key));
            continue;
        }
        results.put(key, value);
    }
}
 
开发者ID:justimkiss,项目名称:bee,代码行数:27,代码来源:PropertiesUtils.java

示例12: buildEntityWithBodyParam

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/** 
 * 
 * @param map
 * 
 * @return HttpEntity
 */
public static HttpEntity buildEntityWithBodyParam(Map<String, String> map) {
	if (MapUtils.isEmpty(map)) {
		return null;
	}
	MultipartEntityBuilder builder = MultipartEntityBuilder.create();
	map.forEach((k, v) -> builder.addTextBody(k, v));
	return builder.build();
}
 
开发者ID:Zymr,项目名称:visitormanagement,代码行数:15,代码来源:HttpConnectorHelper.java

示例13: buildMultiPartEntity

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/**
 * @param buildMap
 * @param partParam
 * 
 * @return HttpEntity
 */
public static HttpEntity buildMultiPartEntity(Map<String, String> buildMap, Map<String, ContentBody> partParam) {
	if (MapUtils.isEmpty(buildMap)) {
		return null;
	}
	MultipartEntityBuilder builder = MultipartEntityBuilder.create();
	buildMap.forEach((k, v) -> builder.addTextBody(k, v));
	if (MapUtils.isNotEmpty(partParam)) {
		partParam.forEach((k, v) -> builder.addPart(k, v));	
	}
	return builder.build();
}
 
开发者ID:Zymr,项目名称:visitormanagement,代码行数:18,代码来源:HttpConnectorHelper.java

示例14: articlesFromChannelMap

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
private List<Article> articlesFromChannelMap(long userId, Map<Channel, List<Document>> channelMap, int limit) {
    if (MapUtils.isEmpty(channelMap)) {
        return Collections.emptyList();
    }
    Map<Channel, List<Document>> filteredMap = new HashMap<>();
    channelMap.entrySet().forEach(e -> filteredMap.put(e.getKey(), e.getValue().stream().limit(limit).collect(Collectors.toList())));

    List<Article> articles = new ArrayList<>();
    filteredMap.entrySet().forEach(e -> articles.addAll(Article.of(e.getKey(), e.getValue().stream().collect(Collectors.toList()))));

    FeedUtils.markBookmarks(articles, articleDao.getBookmarked(userId));
    return FeedUtils.sort(articles);
}
 
开发者ID:jtanza,项目名称:rufus,代码行数:14,代码来源:FeedProcessorImpl.java

示例15: doRequest

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
@Override
protected int doRequest(Jedis jedis, String redisAddress) {
  Map<byte[], byte[]> redisData = jedis.hgetAll(key.getBytes());
  redisDataList[index] = redisData;
  if (MapUtils.isEmpty(redisData)) {
    String verbose = String.format("get all for key [%s] from [%s] is empty", key, redisAddress);
    LOGGER.debug(verbose);
    return 1;
  }
  return 0;
}
 
开发者ID:XiaoMi,项目名称:ECFileCache,代码行数:12,代码来源:RedisGetAll.java


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