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


Java MapUtils.isNotEmpty方法代码示例

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


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

示例1: isDefined

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/**
 * 判断对象是不是定义了 <br>
 * List的话,不为NULL和空<br>
 * 字符串的的话,不为NULL或空<br>
 * Integer的话,不为NULL或0<br>
 * 
 * @param obj
 *            要判断的对象
 * @return 是否定义了
 */
public static boolean isDefined(Object obj) {
    if (obj instanceof Collection) {
        return CollectionUtils.isNotEmpty((Collection<?>) obj);
    }

    if (obj instanceof Map) {
        return MapUtils.isNotEmpty((Map<?, ?>) obj);
    }

    if (obj instanceof String) {
        return StringUtils.isNotEmpty((String) obj);
    }

    if (obj instanceof Integer) {
        return obj != null && (Integer) obj != 0;
    }

    return obj != null;
}
 
开发者ID:Chihpin,项目名称:Yidu,代码行数:30,代码来源:Utils.java

示例2: onChanged

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
@Override
public void onChanged(String parentPath, List<String> currentChildren) {
  if (currentChildren == null) {
    LOGGER.error("{} is null", parentPath);
    return;
  } else {
    LOGGER.warn("{} is changed to '{}'", parentPath, currentChildren);
  }

  Map<Integer, String> zkRedisCluster = new HashMap<Integer, String>();
  for (String node : currentChildren) {
    String nodeData = client.getData(String.class, parentPath + SLASH + node);
    zkRedisCluster.put(Integer.parseInt(node), nodeData);
  }

  if (MapUtils.isNotEmpty(zkRedisCluster) && !zkRedisCluster.equals(redisCluster)) {
    redisCluster = zkRedisCluster;
    if (isRedisAccessParallel) {
      redisAccess = new RedisAccessParallel(zkRedisCluster);
    } else {
      redisAccess = new RedisAccessSerial(zkRedisCluster);
    }
  }
}
 
开发者ID:XiaoMi,项目名称:ECFileCache,代码行数:25,代码来源:ZKChildMonitor.java

示例3: queryEntity

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
@Override
public <T> T queryEntity(Class<T> entityClass, String sql, Object... params) {
    T result;
    try {
        Map<String, String> columnMap = EntityHelper.getColumnMap(entityClass);
        if (MapUtils.isNotEmpty(columnMap)) {
            result = queryRunner.query(sql, new BeanHandler<T>(entityClass, new BasicRowProcessor(new BeanProcessor(columnMap))), params);
        } else {
            result = queryRunner.query(sql, new BeanHandler<T>(entityClass), params);
        }
    } catch (SQLException e) {
        logger.error("查询出错!", e);
        throw new RuntimeException(e);
    }
    printSQL(sql);
    return result;
}
 
开发者ID:xuerong,项目名称:MMServerEngine,代码行数:18,代码来源:DefaultDataAccessor.java

示例4: createWebTarget

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
private static WebTarget createWebTarget(String uri, Map<String, String> queryParams) throws URISyntaxException
{
    WebTarget webTarget = null;

    URI u = new URI(uri);
    Client client = ClientBuilder.newClient();

    webTarget = client.target(u);

    if (MapUtils.isNotEmpty(queryParams))
    {
        for (Entry<String, String> entry : queryParams.entrySet())
        {
            if (StringUtils.isNotBlank(entry.getKey()) && StringUtils.isNotBlank(entry.getValue()))
            {
                String value = UriComponent.encode(
                        entry.getValue(),
                        UriComponent.Type.QUERY_PARAM_SPACE_ENCODED);

                webTarget = webTarget.queryParam(entry.getKey(), value);
            }
        }
    }

    return webTarget;
}
 
开发者ID:okean,项目名称:alm-rest-api,代码行数:27,代码来源:RestConnector.java

示例5: process

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/**
 * 替换模板内的占位符格式有以下三种:
 * <ul>
 *     <li>template:<i>{}走路掉{}里了</i>  model:<i>["小明", "坑"]</i> &nbsp; --> <i><b>小明</b>走路掉<b>坑</b>里了</i></li>
 *     <li>template:<i>{0}走路掉{1}里了</i>  model:<i>["小东", "缸"]</i> &nbsp; --> <i><b>小东</b>走路掉<b>缸</b>里了</i></li>
 *     <li>template:<i>{name}走路掉{thing}里了</i>  model:<i>{"name": "小李", "thing": "池塘"}</i> &nbsp; --> <i><b>小李</b>走路掉<b>池塘</b>里了</i></li>
 * </ul>
 * @param template 模板内容
 * @param model 替换数据 - 可以是POJO对象或者Map类型或者数组
 * @return
 */
@Override
public String process(String template, Object model) throws ParseTemplateException {
    int mode = Strings.EMPTY_INDEX_MODEL | Strings.NUM_INDEX_MODEL | Strings.KEY_VALUE_MODEL;
    try {
        String roughTmpl;
        if (model != null && model.getClass().isArray()
                && !model.getClass().getComponentType().isPrimitive()) {
            roughTmpl = Strings.formatMix(template, mode, defaultVal, (Object[]) model);
        } else {
            roughTmpl = Strings.formatMix(template, mode, defaultVal, model);
        }
        if (MapUtils.isNotEmpty(this.globalModel)) {
            roughTmpl = Strings.formatMix(roughTmpl, mode, defaultVal, this.globalModel);
        }
        return roughTmpl;
    } catch (Exception e) {
        throw new ParseTemplateException("Parse template error.", e);
    }
}
 
开发者ID:easycodebox,项目名称:easycode,代码行数:31,代码来源:StringTemplateProcessor.java

示例6: toCustomFieldValues

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
public <CFV extends CustomFieldValue> void toCustomFieldValues(final Class<CFV> valueClass, final List<? extends CustomField> allowedFields, final Map<String, String> customValues, final Collection<CFV> fieldValues) {
    if (MapUtils.isNotEmpty(customValues)) {
        for (String internalName : customValues.keySet()) {
            String value = customValues.get(internalName);
            if (StringUtils.isNotEmpty(value)) {
                CustomField field = customFieldHelper.findByInternalName(allowedFields, internalName);
                if (field == null) {
                    throw new IllegalArgumentException("Couldn't find custom field with internal name: '" + internalName + "' or the field is not searchable");
                } else {
                    CFV fieldValue;
                    try {
                        fieldValue = valueClass.newInstance();
                    } catch (Exception e) {
                        throw new IllegalStateException(e);
                    }
                    fieldValue.setField(field);
                    fieldValue.setValue(value);
                    fieldValues.add(fieldValue);
                }
            }
        }
    }
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:24,代码来源:FieldHelper.java

示例7: getPattrenId

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
private Long getPattrenId(String modelType, Map<Long, Integer> contentionCounts, List<DiagnosisCount> diagnosisCount, Long claimantAge, Long claimCount, long size, long cddAge) {
    List<DDMModelPattern> patterns = ddmDataService.getPatternId(modelType, claimantAge, claimCount, size, cddAge);
    List<Long> diagPattren = new ArrayList<>();
    List<Long> cntntPattrens = new ArrayList<>();
    Long pattrenId = null;
    if (CollectionUtils.isNotEmpty(patterns)) {
        List<Long> patternsList = patterns.stream().map(DDMModelPattern::getPatternId).collect(Collectors.toList());
        if(MapUtils.isNotEmpty(contentionCounts)){
             LOG.info("Contention count :::::: " + contentionCounts);
            cntntPattrens = ddmModelCntntService.getKneePatternId(contentionCounts, patternsList, modelType.toUpperCase());
        }
        if (CollectionUtils.isNotEmpty(cntntPattrens)) {
            //List<Long> diagPatternsList = patterns.stream().map(DDMModelPattern::getPatternId).collect(Collectors.toList());
            if (CollectionUtils.isNotEmpty(diagnosisCount)) {
                LOG.info("Diagnosis count :::::: " + diagnosisCount);
                diagPattren = ddmModelDiagService.getKneePatternId(diagnosisCount, cntntPattrens, modelType.toUpperCase());
            }
            LOG.info("PATTREN SIZE :::::: " + diagPattren);
            if (CollectionUtils.isNotEmpty(diagPattren)) {
                pattrenId = diagPattren.get(0);
                LOG.info("PATTREN ID :: " + pattrenId);
            }
        }
    }
    return pattrenId;
}
 
开发者ID:VHAINNOVATIONS,项目名称:BCDS,代码行数:27,代码来源:ClaimDataService.java

示例8: 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

示例9: parseUserAgent

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
private static void parseUserAgent(XmTimeline timeline) {
    if (MapUtils.isNotEmpty(timeline.getRequestHeaders())) {
        String ua = timeline.getRequestHeaders().get("user-agent");
        if (StringUtils.isNotBlank(ua)) {
            ReadableUserAgent agent = parser.parse(ua);
            timeline.setBrowser(agent.getName() + " " + agent.getVersionNumber().toVersionString());
            timeline.setOpSystem(agent.getOperatingSystem().getName() + " "
                + agent.getOperatingSystem().getVersionNumber().toVersionString());
        }
    }
}
 
开发者ID:xm-online,项目名称:xm-ms-timeline,代码行数:12,代码来源:TimelineMapper.java

示例10: buildParamMap

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
protected Map<String, Object> buildParamMap(HttpServletRequest request) {
    Map<String, Object> paramMap = new HashMap();
    Map<String, String[]> maps = request.getParameterMap();
    if (MapUtils.isNotEmpty(maps)) {
        maps.forEach((key, value) -> paramMap.put(key, value[0]));
    }
    return paramMap;
}
 
开发者ID:lupindong,项目名称:xq_seckill_microservice,代码行数:9,代码来源:BasicController.java

示例11: updateCookies

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
private void updateCookies(Map<String, NewCookie> newCookies)
{
    if (MapUtils.isNotEmpty(newCookies))
    {
        cookies.putAll(newCookies);
    }
}
 
开发者ID:okean,项目名称:alm-rest-api,代码行数:8,代码来源:RestConnector.java

示例12: init

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
@PostConstruct
public void init() throws Exception {
    Assert.isFalse(freeMarkerConfigurationFactory == null && configuration == null,
            "freeMarkerConfigurationFactory and configuration are both null.");
    if (configuration == null && freeMarkerConfigurationFactory != null) {
        configuration = freeMarkerConfigurationFactory.createConfiguration();
    }
    if (MapUtils.isNotEmpty(this.globalModel)) {
        configuration.setAllSharedVariables(new SimpleHash(this.globalModel, configuration.getObjectWrapper()));
    }
}
 
开发者ID:easycodebox,项目名称:easycode,代码行数:12,代码来源:FreemarkerTemplateProcessor.java

示例13: sendTemplateMsg

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/**
 * 发送模板消息
 *
 * @param toUser     接受者OpenId
 * @param templateId 使用的模板Id,通过{@link #getTemplateId(String)}获取的
 * @param url        微信中点击消息后进入的页面
 * @param datas      需要的数据
 * @return 消息id
 */
public String sendTemplateMsg(String toUser, String templateId, String url, List<TemplateData> datas) {
    Assert.hasText(toUser);
    Assert.hasText(templateId);
    Assert.hasText(url);
    Assert.notNull(datas);

    Map<String, Object> params = new HashMap<>(4);
    params.put("touser", toUser);
    params.put("template_id", templateId);
    params.put("url", url);

    Map<String, Map<String, String>> configs = new HashMap<>(datas.size());
    for (TemplateData data : datas) {
        String key = data.getKey();
        String color = data.getColor();
        String value = data.getValue();

        Map<String, String> temp = new HashMap<>(2);
        temp.put("color", color);
        temp.put("value", value);

        configs.put(key, temp);
    }
    params.put("data", configs);

    Map<String, Object> result = WeChatRequest.post(String.format(WeChatUrl.API_SEND_TEMPLATE_MESSAGE, WeChat.accessToken()), params,
            new TypeReference<Map<String, Object>>() {
            });

    return MapUtils.isNotEmpty(result) ? (result.get("msgid") != null ? result.get("msgid").toString() : StringUtils.EMPTY) : StringUtils.EMPTY;
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:41,代码来源:WeChatTemplateService.java

示例14: getAttributeValue

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/**
 * Required provisioning entity attribute value can be retrieved by passing attribute key, return null if value is
 * not found
 * @param provisioningEntity
 * @param claimURI
 * @return
 */
public static String getAttributeValue(ProvisioningEntity provisioningEntity, String claimURI){
    Map<org.wso2.carbon.identity.application.common.model.ClaimMapping, List<String>> attributes =
            provisioningEntity.getAttributes();
    if (MapUtils.isNotEmpty(attributes)) {
        List<String> valueList = attributes.get(org.wso2.carbon.identity.application.common.model.ClaimMapping
                                                        .build(claimURI, null, null, false));
        if (valueList != null && !valueList.isEmpty()) {
            return valueList.get(0);
        }
    }
    return null;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:ProvisioningUtil.java

示例15: setClaimsForComplexAttribute

import org.apache.commons.collections.MapUtils; //导入方法依赖的package包/类
/**
 * set claim mapping for complex attribute
 * @param entry
 * @param claimsMap
 */
private static void setClaimsForComplexAttribute(Attribute entry, Map<String, String> claimsMap) throws CharonException {

    // reading attributes list of the complex attribute
    ComplexAttribute entryOfComplexAttribute = (ComplexAttribute) entry;
    Map<String, Attribute> entryAttributes = null;
    if (entryOfComplexAttribute.getSubAttributesList() != null &&
            MapUtils.isNotEmpty(entryOfComplexAttribute.getSubAttributesList())) {
        entryAttributes = entryOfComplexAttribute.getSubAttributesList();
    }
    for (Attribute subEntry : entryAttributes.values()) {
        // attribute can only be simple attribute and that also in the extension schema only
        setClaimsForSimpleAttribute(subEntry, claimsMap);
    }
}
 
开发者ID:Vindulamj,项目名称:scim-inbound-provisioning-scim2,代码行数:20,代码来源:AttributeMapper.java


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