March 12, 2003


Commons JXPath - The announcement on TSS is the first I’ve heard of this. It’s kind of like the JSTL EL but in code. From one of their examples, this JXPath expression:

Address address = (Address)JXPathContext.newContext(vendor).

is equivalent to this Java code:

Address address = null;
Collection locations = vendor.getLocations();
Iterator it = locations.iterator();
while (it.hasNext()){
    Location location = (Location);
    String zipCode = location.getAddress().getZipCode();
    if (zipCode.equals("90210")){
      address = location.getAddress();

Very perlish, don't you think?

It's interesting how a number of the Jakarta Commons projects are implementing these sorts of shortcuts to make verbose Java more succinct -- some of the classes in the Commons Collections package library are trying to fold functional idioms (like map) into Java, which is most welcome.

Next: Free worship
Previous: Car troubles update