package com.alibaba.o2o.ad.kmonitor.utils; import com.google.common.collect.Maps; import org.apache.commons.lang3.StringUtils; import java.util.List; import java.util.Map; /** * @author michael.he * @date 2019-11-27 */ public class SpelUtil { public static final String forEachTag = "forEachTag"; public static final String forEachPrefixTag = "forEachPrefixTag"; public static final String tag = "tag"; public static Map<String, String> forEachTag(List<String> value) { return forEachPrefixTag("", value); } public static Map<String, String> forEachPrefixTag(String prefix, List<String> value) { Map<String, String> result = Maps.newHashMap(); if(value != null) { value.stream().forEach(v -> { result.put(prefix + v, v); }); } return result; } public static Map<String, String> tag(String key, String value) { Map<String, String> result = Maps.newHashMap(); result.put(StringUtils.defaultString(key,""), StringUtils.defaultString(value,"")); return result; } }
Spel表达式自定义函数
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 先创建服务端的APP 1.官网下载Winrun4j。http://winrun4j.sourceforge.net...
- Elasticsearch DSL写的很崩溃,自己定义了个工具类, 然后这样撸起来还挺方便的,习惯了restful...
- 个人专题目录 Apache Commons包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动。下...