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


Java MapUtils.isNotEmpty方法代码示例

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


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

示例1: addDefaultParams

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
private void addDefaultParams(SolrQuery solrQuery, SolrEndpointConfiguration config) {
    if(MapUtils.isNotEmpty(config.getDefaults())){
        config.getDefaults().entrySet().stream()
        .filter(e -> StringUtils.isNoneBlank(e.getKey()) && e.getValue() != null)
        .forEach(e -> {
            String param = e.getKey();
            Collection<?> values;
            if(e.getValue() instanceof Collection){
                values = (Collection<?>)e.getValue();
            } else if(e.getValue().getClass().isArray()) {
                 values = Arrays.asList((Object[])e.getValue());
            } else {
                values = Collections.singleton(e.getValue());
            }
            Collection<String> strValues = StreamSupport.stream(values.spliterator(), false)
                    .map(Objects::toString) //convert values to strings
                    .filter(StringUtils::isNoneBlank) //filter blank values
                    .collect(Collectors.toList());
            if(!strValues.isEmpty()){
                solrQuery.add(param, strValues.toArray(new String[strValues.size()]));
            }
        });
    }
}
 
开发者ID:redlink-gmbh,项目名称:smarti,代码行数:25,代码来源:SolrSearchQueryBuilder.java

示例2: init

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
    super.init(processingEnv);

    routerNodes = new ArrayList<>();

    mFiler = processingEnv.getFiler();
    types = processingEnv.getTypeUtils();
    elements = processingEnv.getElementUtils();
    typeUtils = new TypeUtils(types, elements);

    type_String = elements.getTypeElement("java.lang.String").asType();

    logger = new Logger(processingEnv.getMessager());

    Map<String, String> options = processingEnv.getOptions();
    if (MapUtils.isNotEmpty(options)) {
        host = options.get(KEY_HOST_NAME);
        logger.info(">>> host is " + host + " <<<");
    }
    if (host == null || host.equals("")) {
        host = "default";
    }
    logger.info(">>> RouteProcessor init. <<<");
}
 
开发者ID:luojilab,项目名称:DDComponentForAndroid,代码行数:26,代码来源:RouterProcessor.java

示例3: generateRouterTable

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
/**
 * generate HostRouterTable.txt
 */
private void generateRouterTable() {
    String fileName = RouteUtils.genRouterTable(host);
    if (FileUtils.createFile(fileName)) {

        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("auto generated, do not change !!!! \n\n");
        stringBuilder.append("HOST : " + host + "\n\n");

        for (Node node : routerNodes) {
            stringBuilder.append(node.getDesc() + "\n");
            stringBuilder.append(node.getPath() + "\n");
            Map<String, String> paramsType = node.getParamsDesc();
            if (MapUtils.isNotEmpty(paramsType)) {
                for (Map.Entry<String, String> types : paramsType.entrySet()) {
                    stringBuilder.append(types.getKey() + ":" + types.getValue() + "\n");
                }
            }
            stringBuilder.append("\n");
        }
        FileUtils.writeStringToFile(fileName, stringBuilder.toString(), false);
    }
}
 
开发者ID:luojilab,项目名称:DDComponentForAndroid,代码行数:26,代码来源:RouterProcessor.java

示例4: setApplicationContext

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
@Override
public void setApplicationContext(ApplicationContext ctx) throws BeansException {
    if (useRpc) {
        // 扫描带有 RpcService 注解的类并初始化 handlerMap 对象
        Map<String, Object> serviceBeanMap = ctx.getBeansWithAnnotation(RpcService.class);
        if (MapUtils.isNotEmpty(serviceBeanMap)) {
            for (Object serviceBean : serviceBeanMap.values()) {
                RpcService rpcService = serviceBean.getClass().getAnnotation(RpcService.class);
                String serviceName = rpcService.value().getName();
                String serviceVersion = rpcService.version();
                if (StringUtil.isNotEmpty(serviceVersion)) {
                    serviceName += "-" + serviceVersion;
                }
                handlerMap.put(serviceName, serviceBean);
            }
        }
    }
    if (useRestFul) {
        if (restfulServer == null) {
            throw new RuntimeException("restful server bean not be set ,please check it ");
        }
    }

}
 
开发者ID:netboynb,项目名称:coco,代码行数:25,代码来源:CocoServer.java

示例5: sendSupportEmail

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
public void sendSupportEmail(String message, String stackTrace) {
    try {
        User user = userSessionSource.getUserSession().getUser();
        String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timeSource.currentTimestamp());

        Map<String, Object> binding = new HashMap<>();
        binding.put("timestamp", date);
        binding.put("errorMessage", message);
        binding.put("stacktrace", stackTrace);
        binding.put("systemId", clientConfig.getSystemID());
        binding.put("userLogin", user.getLogin());

        if (MapUtils.isNotEmpty(additionalExceptionReportBinding)) {
            binding.putAll(additionalExceptionReportBinding);
        }

        reportService.sendExceptionReport(clientConfig.getSupportEmail(), MapUtils.unmodifiableMap(binding));

        Notification.show(messages.getMainMessage("exceptionDialog.emailSent"));
    } catch (Throwable e) {
        log.error("Error sending exception report", e);
        Notification.show(messages.getMainMessage("exceptionDialog.emailSendingErr"));
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:25,代码来源:ExceptionDialog.java

示例6: loadCaseConversion

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
protected void loadCaseConversion(TextInputField.CaseConversionSupported component, Element element) {
    final String caseConversion = element.attributeValue("caseConversion");
    if (StringUtils.isNotEmpty(caseConversion)) {
        component.setCaseConversion(TextInputField.CaseConversion.valueOf(caseConversion));
        return;
    }

    if (resultComponent.getMetaPropertyPath() != null) {
        Map<String, Object> annotations = resultComponent.getMetaPropertyPath().getMetaProperty().getAnnotations();

        //noinspection unchecked
        Map<String, Object> conversion = (Map<String, Object>) annotations.get(CaseConversion.class.getName());
        if (MapUtils.isNotEmpty(conversion)) {
            ConversionType conversionType = (ConversionType) conversion.get("type");
            TextInputField.CaseConversion tfCaseConversion = TextInputField.CaseConversion.valueOf(conversionType.name());
            component.setCaseConversion(tfCaseConversion);
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:AbstractTextFieldLoader.java

示例7: updateSession

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
@Override
public void updateSession(Map<String, Object> attributesToUpdate, Set<String> attributesToRemove, String namespace, String id) {
    StringBuilder statement = new StringBuilder("UPDATE `").append(bucket).append("` USE KEYS $1");
    List<Object> parameters = new ArrayList<>(attributesToUpdate.size() + attributesToRemove.size() + 1);
    parameters.add(id);
    int parameterIndex = 2;
    if (MapUtils.isNotEmpty(attributesToUpdate)) {
        statement.append(" SET ");
        for (Entry<String, Object> attribute : attributesToUpdate.entrySet()) {
            parameters.add(attribute.getValue());
            statement.append("data.`").append(namespace).append("`.`").append(attribute.getKey()).append("` = $").append(parameterIndex++).append(",");
        }
        deleteLastCharacter(statement);
    }
    if (CollectionUtils.isNotEmpty(attributesToRemove)) {
        statement.append(" UNSET ");
        attributesToRemove.forEach(name -> statement.append("data.`").append(namespace).append("`.`").append(name).append("`,"));
        deleteLastCharacter(statement);
    }
    executeQuery(statement.toString(), from(parameters));
}
 
开发者ID:mkopylec,项目名称:session-couchbase-spring-boot-starter,代码行数:22,代码来源:PersistentDao.java

示例8: extractOutputs

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
public static Map<String, Serializable> extractOutputs(LanguageEventData data) {

        Map<String, Serializable> outputsMap = new HashMap<>();

        boolean thereAreOutputsForRootPath = data.containsKey(LanguageEventData.OUTPUTS) &&
                data.containsKey(LanguageEventData.PATH) &&
                data.getPath().equals(EXEC_START_PATH);

        if (thereAreOutputsForRootPath) {
            Map<String, Serializable> outputs = data.getOutputs();
            if (MapUtils.isNotEmpty(outputs)) {
                outputsMap.putAll(outputs);
            }
        }

        return outputsMap;
    }
 
开发者ID:CloudSlang,项目名称:cloud-slang,代码行数:18,代码来源:TriggerTestCaseEventListener.java

示例9: handleTestCaseFailuresFromOutputs

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
private void handleTestCaseFailuresFromOutputs(SlangTestCase testCase, String testCaseReference,
                                               Map<String, Serializable> outputs,
                                               Map<String, Serializable> executionOutputs) {
    String message;
    if (MapUtils.isNotEmpty(outputs)) {
        for (Map.Entry<String, Serializable> output : outputs.entrySet()) {
            String outputName = output.getKey();
            Serializable outputValue = output.getValue();
            Serializable executionOutputValue = executionOutputs.get(outputName);
            if (!executionOutputs.containsKey(outputName) ||
                    !outputsAreEqual(outputValue, executionOutputValue)) {
                message = TEST_CASE_FAILED + testCaseReference + " - " + testCase.getDescription() +
                        "\n\tFor output: " + outputName + "\n\tExpected value: " + outputValue +
                        "\n\tActual value: " + executionOutputValue;

                loggingService.logEvent(Level.ERROR, message);
                throw new RuntimeException(message);
            }
        }
    }
}
 
开发者ID:CloudSlang,项目名称:cloud-slang,代码行数:22,代码来源:SlangTestRunner.java

示例10: resolveDoReferenceId

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
private String resolveDoReferenceId(String rawReferenceId, Map<String, String> imports, String namespace) {

        int numberOfDelimiters = StringUtils.countMatches(rawReferenceId, NAMESPACE_DELIMITER);
        String resolvedReferenceId;

        if (numberOfDelimiters == 0) {
            // implicit namespace
            resolvedReferenceId = namespace + NAMESPACE_DELIMITER + rawReferenceId;
        } else {
            String prefix = StringUtils.substringBefore(rawReferenceId, NAMESPACE_DELIMITER);
            String suffix = StringUtils.substringAfter(rawReferenceId, NAMESPACE_DELIMITER);
            if (MapUtils.isNotEmpty(imports) && imports.containsKey(prefix)) {
                // expand alias
                resolvedReferenceId = imports.get(prefix) + NAMESPACE_DELIMITER + suffix;
            } else {
                // full path without alias expanding
                resolvedReferenceId = rawReferenceId;
            }
        }

        return resolvedReferenceId;
    }
 
开发者ID:CloudSlang,项目名称:cloud-slang,代码行数:23,代码来源:ExecutableBuilder.java

示例11: extractNotEmptyOutputs

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
public static Map<String, Serializable> extractNotEmptyOutputs(Map<String, Serializable> data) {

        Map<String, Serializable> originalOutputs = (Map<String, Serializable>) data.get(LanguageEventData.OUTPUTS);
        Map<String, Serializable> extractedOutputs = new HashMap<>();

        if (MapUtils.isNotEmpty(originalOutputs)) {
            for (Map.Entry<String, Serializable> output : originalOutputs.entrySet()) {
                if (output.getValue() != null && !(StringUtils.isEmpty(output.getValue().toString()))) {
                    extractedOutputs.put(output.getKey(),
                            StringUtils.abbreviate(output.getValue().toString(), 0, OUTPUT_VALUE_LIMIT));
                }
            }
            return extractedOutputs;
        }
        return new HashMap<>();
    }
 
开发者ID:CloudSlang,项目名称:cloud-slang,代码行数:17,代码来源:SyncTriggerEventListener.java

示例12: getConnectionData

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
/**
 * Returns the list of {@link ConnectionData} associated to the provider ID of
 * the specified profile
 *
 * @param profile       the profile that contains the connection data in its attributes
 * @param providerId    the provider ID of the connection
 * @param encryptor     the encryptor used to decrypt the accessToken, secret and refreshToken
 *
 * @return the list of connection data for the provider, or empty if no connection data was found
 */
public static List<ConnectionData> getConnectionData(Profile profile, String providerId,
                                                     TextEncryptor encryptor) throws CryptoException {
    Map<String, List<Map<String, Object>>> allConnections = profile.getAttribute(CONNECTIONS_ATTRIBUTE_NAME);

    if (MapUtils.isNotEmpty(allConnections)) {
        List<Map<String, Object>> connectionsForProvider = allConnections.get(providerId);

        if (CollectionUtils.isNotEmpty(connectionsForProvider)) {
            List<ConnectionData> connectionDataList = new ArrayList<>(connectionsForProvider.size());

            for (Map<String, Object> connectionDataMap : connectionsForProvider) {
                connectionDataList.add(mapToConnectionData(providerId, connectionDataMap, encryptor));
            }

            return connectionDataList;
        }
    }

    return Collections.emptyList();
}
 
开发者ID:craftercms,项目名称:profile,代码行数:31,代码来源:ConnectionUtils.java

示例13: removeConnectionData

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
/**
 * Remove the {@link ConnectionData} associated to the provider ID and user ID.
 *
 * @param providerId        the provider ID of the connection
 * @param providerUserId    the provider user ID
 * @param profile           the profile where to remove the data from
 */
public static void removeConnectionData(String providerId, String providerUserId, Profile profile) {
    Map<String, List<Map<String, Object>>> allConnections = profile.getAttribute(CONNECTIONS_ATTRIBUTE_NAME);

    if (MapUtils.isNotEmpty(allConnections)) {
        List<Map<String, Object>> connectionsForProvider = allConnections.get(providerId);

        if (CollectionUtils.isNotEmpty(connectionsForProvider)) {
            for (Iterator<Map<String, Object>> iter = connectionsForProvider.iterator(); iter.hasNext();) {
                Map<String, Object> connectionDataMap = iter.next();

                if (providerUserId.equals(connectionDataMap.get("providerUserId"))) {
                    iter.remove();
                }
            }
        }
    }
}
 
开发者ID:craftercms,项目名称:profile,代码行数:25,代码来源:ConnectionUtils.java

示例14: createProfile

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
@Override
public Profile createProfile(String tenantName, String username, String password, String email, boolean enabled,
                             Set<String> roles, Map<String, Object> attributes, String verificationUrl)
        throws ProfileException {
    MultiValueMap<String, String> params = createBaseParams();
    HttpUtils.addValue(PARAM_TENANT_NAME, tenantName, params);
    HttpUtils.addValue(PARAM_USERNAME, username, params);
    HttpUtils.addValue(PARAM_PASSWORD, password, params);
    HttpUtils.addValue(PARAM_EMAIL, email, params);
    HttpUtils.addValue(PARAM_ENABLED, enabled, params);
    HttpUtils.addValues(PARAM_ROLE, roles, params);
    if (MapUtils.isNotEmpty(attributes)) {
        HttpUtils.addValue(PARAM_ATTRIBUTES, serializeAttributes(attributes), params);
    }
    HttpUtils.addValue(PARAM_VERIFICATION_URL, verificationUrl, params);

    String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_CREATE);

    return doPostForObject(url, params, Profile.class);
}
 
开发者ID:craftercms,项目名称:profile,代码行数:21,代码来源:ProfileServiceRestClient.java

示例15: addMappedParams

import org.apache.commons.collections4.MapUtils; //导入方法依赖的package包/类
public void addMappedParams(Map<String, String> params, ParamPosition position){
    if(MapUtils.isNotEmpty(params)){
        for(Entry<String, String> entry : params.entrySet()){
            addParam(entry.getKey(), entry.getValue(), position, false);
        }
    }
}
 
开发者ID:aliyun,项目名称:apigateway-sdk-core,代码行数:8,代码来源:ApiRequest.java


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