Jakarta-Common-JXPath操纵笔记[Java编程]
本文“Jakarta-Common-JXPath操纵笔记[Java编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
JXPath是apache公司供应的XPath的java实现,属于jakarta的一部份,最新的版本是1.1,JXPath的主要功效在于一组java类库来利用XPath的方法拜候符合JavaBeans标准的java类、java调集(Collections)、其他具有动态属性的对象(如Map、ServletContext等),同时供应了一套扩大机制使我们可以增添对这些对象之外的其他对象模子的支持.
下载地址:http://commons.apache.org/jxpath/
A.拜候JavaBean的属性
package demo.bean;
import java.util.Comparator;
public class Company implements Comparator<Object>...{
private String name = "";
private int id = 0;
private String address = "";
public void setName(String p_name)...{
this.name = p_name;
}
public void setId(int p_id)...{
this.id = p_id;
}
public void setAddress(String p_address)...{
this.address = p_address;
}
public String getName()...{
return this.name;
}
public int getId()...{
return this.id;
}
public String getAddress()...{
return this.address;
}
public int compare(Object o1, Object o2)...{
return 0;
}
public boolean equals(Object obj) ...{
boolean result = false;
if (obj instanceof Company)...{
Company company = (Company) obj;
if (company.getId()==this.id && company.getName().equals(this.getName())
&& company.getAddress().equals(this.getAddress()))
result = true;
}
return result;
}
}
以上是“Jakarta-Common-JXPath操纵笔记[Java编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |