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. TVYJ1266:费解的开关

    我对状态空间的理解:https://www.cnblogs.com/AKMer/p/9622590.html 题目传送门:http://www.joyoi.cn/problem/tyvj-1266 这 ...

  2. Maven运行JUnit测试(http://www.360doc.com/content/13/0927/15/7304817_317455642.shtml)

    Maven单元测试 分类: maven 2012-05-09 15:17 1986人阅读 评论(1) 收藏 举报 maven测试junit单元测试javarandom   目录(?)[-] maven ...

  3. poj 2390 Bank Interest(计算本利和)

    一.Description Farmer John made a profit last year! He would like to invest it well but wonders how m ...

  4. 超牛 猴子补丁,修改python内置的print

    猴子补丁一般是用于修改三方包或官方包,也可以用来修改自己或者他人的代码. 但也可以用来修改python 语言内置的关键字. 本篇博客修改python最常用的内置print,使你使用print时候,自动 ...

  5. MS SQL update set select

    有张表a,已经有数据 再有张表b,也已查询出数据 两张表有外键关联 需求如下: 更新表a中的某个字段,这个字段要加上(都是int型的数据)对应表b中的数据作为更新的最终数据 )) from #libL ...

  6. 使用LookAndFeel为界面更换皮肤

    ----------------siwuxie095                             在 Windows 系统中,默认的 Java 运行环境(JRE)会为当前的窗体程序 指定一 ...

  7. assert.strictEqual()

    assert.strictEqual(actual, expected[, message]) 使用全等运算符(===)测试 actual 参数与 expected 参数是否全等. // 格式 ass ...

  8. Entity Framework Code-First(9.1):DataAnnotations - Key Attribute

    DataAnnotations - Key Attribute: Key attribute can be applied to properties of a class. Default Code ...

  9. BOX (UVA-1587) 比较代码书写上的差距

    对比一下代码的书写差距: 我的代码: #include<iostream> using namespace std; ]; ]; ]; //访问标记 bool judge(int i, i ...

  10. rest framework 权限

    一.权限示例 需求:不同的用户类型有不同的权限 普通用户:只能查看个人信息相关,序号:1 VIP 用户:只能查看个人信息相关,序号:2 SVIP 用户:查看订单相关信息,序号:3 1.新建 app/u ...