Jakarta-common-jxpath Use Notes

Source: Internet
Author: User
Tags xpath

Jxpath is a Java implementation of the XPath provided by Apache, part of the Jakarta, and the latest version is 1.1,jxpath's main feature is a set of Java class libraries that use XPath to access Java classes that conform to the JavaBeans specification, Java Collections (collections), other objects with dynamic properties (such as map, ServletContext, and so on) provide a set of extension mechanisms that allow us to increase support for other object models outside of these objects.

Download Address: http://commons.apache.org/jxpath/

A. Accessing the JavaBean properties

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;
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.