import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;


public static Collection<Parameter> filterScope(Collection<Parameter> params, final String scope){
if (null == params || params.size() == 0){
return null;
}
if(StringUtils.isBlank(scope)) {
return params;
} Collection<Parameter> results = CollectionUtils.select(params, new Predicate() { @Override
public boolean evaluate(Object object) {
if(Parameter.class.isAssignableFrom(object.getClass())) {
Parameter param = (Parameter) object;
if(StringUtils.isNotBlank(param.getParameterScope()) &&
Arrays.asList(param.getParameterScope().split(",")).contains(scope.toUpperCase())) {
return true;
}
}
return false;
}
});
return results;
}
<!-- 是否管控批号  -->
<parameter>
<parameterCategory>normal</parameterCategory>
<parameterCode>lot_no_concerned</parameterCode>
<defaultParameterName>是否管控批号</defaultParameterName>
<defaultDisplayName>批号</defaultDisplayName>
<defaultParameterCategory>wms</defaultParameterCategory>
<defaultParameterValue>0</defaultParameterValue>
<parameterValues></parameterValues>
<defaultParameterNotes>用于物料进入系统时是否必须输入批号</defaultParameterNotes>
<parameterMantainType>CHECKBOX</parameterMantainType>
<parameterLengthAccuracy></parameterLengthAccuracy>
<parameterFormatReference></parameterFormatReference>
<parameterScope>ORG_MATERIAL,MATERIAL,ORG_OWNER,OWNER,ORG,GLOBAL</parameterScope>
</parameter>

CollectionUtils.select 集合筛选的更多相关文章

  1. CollectionUtils.select用法

    import java.util.ArrayList;import java.util.List; import org.apache.commons.collections.CollectionUt ...

  2. MVC对集合筛选,不使用Where(),而使用FindAll()

    当想对集合筛选的时候,经常想到用Where过滤,而实际上List<T>.FindAll()也是不错的选择. 如果有一个订单,属性有下单时间.区域等等.如何使用List<T>.F ...

  3. jq操作select集合

    jq操作select集合 时间:2012年12月07日分类:Javascript 最近一段时间发现,老是要跟select,option相关的东西打交道,而且有的时候还会搞错,于是,抽了一点时间整理了一 ...

  4. FIRST集合、FOLLOW集合、SELECT集合以及预测分析表地构造

    FIRST集合.FOLLOW集合.SELECT集合以及预测分析表地构造 FIRST集合的简单理解就是推导出的字符串的开头终结符的集合. FOLLOW集合简单的理解就对于非终结符后面接的第一个终结符. ...

  5. 关于Linq对DataTable和List各自的两个集合筛选的相关操作技巧

    项目中用到了对两个集合的帅选等操作,简单总结下 1.Linq操作多个Datable 可以通过AsEnumerable()方法对DataTable进行Linq操作 //获取数据表所有数据 DataTab ...

  6. 开发中CollectionUtils处理集合

    1.org.apache.commons.collections.CollectionUtils; 使用这个工具类,帮我们处理一些集合的操作,非常方便 //取并集public void testUni ...

  7. [转]jQuery操作radio、checkbox、select 集合.

    1.radio:单选框 html代码 <input type="radio" name="radio" id="radio1" val ...

  8. jQuery操作radio、checkbox、select 集合

    1.radio:单选框 HTML代码: <input type="radio" name="radio" id="radio1" va ...

  9. SQL Server游标 C# DataTable.Select() 筛选数据 什么是SQL游标? SQL Server数据类型转换方法 LinQ是什么? SQL Server 分页方法汇总

    SQL Server游标   转载自:http://www.cnblogs.com/knowledgesea/p/3699851.html. 什么是游标 结果集,结果集就是select查询之后返回的所 ...

随机推荐

  1. BZOJ5281:[Usaco2018 Open]Talent Show

    我对二分的理解:https://www.cnblogs.com/AKMer/p/9737477.html 题目传送门:https://www.lydsy.com/JudgeOnline/problem ...

  2. Excel对重复数据分组,求出不同的数据(office 2013)

    第一步: 第二步: 第三步:

  3. nginx与apache 限制ip连接数和带宽方法

    今天有个人问我,nginx怎么限制ip连接数,突然想不起来了,年龄大了,脑子不怎么好使了.还要看一下配置才想起了.那个人又问我,你测试过的吗?一下子把我问蒙了,我真没测试过了,也不知道启作用了没有. ...

  4. Velocity下面的Velocimacros设置

    Velocimacros #macro script element允许模板设计者定义一段可重用的VTL template.Velocimacros广泛用于简单和复杂的行列.Velocimacros的 ...

  5. 请问两个div之间的上下距离怎么设置

    转自:https://zhidao.baidu.com/question/344630087.html 楼上说的是一种方法,yanzilisan183 <div style="marg ...

  6. excel2003, 2007最大行列、sheet数

    1.excel2003版本一个工作表最多可有65536行,行用数字1—65536表示;     256列,列用英文字母A—Z,AA—AZ,BA—BZ,……,IA—IV表示.2.一个工作簿中最多含有25 ...

  7. 你做电商死法TOP10:你中了几枪?

    有相关报道说淘宝目前只有3%的店铺能够盈利,其余97%的店铺基本上都成了炮灰.这是一个非常可怕的数字,都说不赚钱的电商是犯罪,那么,是什么原因导致了会有如此庞大的电商群体一如既往的走在这千军万马的不归 ...

  8. Intent的简单概述

    Intent是负责在系统组件之间传递信息的一个对象,就像名字一样,是一个意图,可以将当前组件的意图传递给系统,例如启动Activity等,还可以在传递的时候附加上一些值,可以用Bundle对象封装这些 ...

  9. [51nod1106]质数检测

    解题关键: 根据质数的定义,在判断一个数n是否是质数时,我们只要用1至n-1去除n,看看能否整除即可.但我们有更好的办法.先找一个数m,使m的平方大于n,再用<=m的质数去除n(n即为被除数), ...

  10. display与position之间的关系

    以防自己忘记写的 网上找的 positon 与 display 的相互关系 元素分为内联元素和区块元素两类(当然也有其它的),在内联元素中有个非常重要的常识,即内两元素是不可以设置区块元素所具有的样式 ...