0
JXPath通過空迭代器在bean列表中搜索rateCode值。Java JXPath迭代列表
我有豆的列表,我想要獲取所有具有rateCode = R1的項目,下面是我的代碼。
class MyBean{
private String rateCode;
public String getRateCode(){
return this.rateCode;
}
public void setRateCode(String rateCode){
this.rateCode=rateCode;
}
}
List<MyBean> list = loadTestData();
JXPathContext ctx = JXPathContext.newContext(list);
Iterator iter = authSrcContext.iterate("*[rateCode='R1']");
while(iter.hasNext()){
Object bp = iter.next();
MyBean bean = (MyBean)bp;
}