PLOTNIX
 

» ENTIA NON SUNT MULTIPLICANDA PRAETER NECESSITATEM -- William of Ockham
» ENTITIES ARE NOT TO BE MULTIPLIED UNNECESSARILY


Contact PLOTNIX, INC


PLOTNIX provides consulting services in such areas as:

»  Servlets, JSP, EJB, JMS
»  Swing, JDBC
»  Apache Struts
»  WebLogic Application Servers


PLOTNIX has been an active contributor to the Apache Open Source Foundation, which is a community of industry enthusiasts supported by such organizations as IBM, Sun and many others.


Related Links 
XPath
XSLT
XPointer
Apache
Jakarta
Struts

Site comments, questions, suggestions, bug reports, complaints or just to say hi, please email us.



   JXPath

JXPath was developed by PLOTNIX in 2001 (as "jpath") and then contributed to Apache Commons (then Apache Jakarta Commons.)

The new home of JXPath is https://commons.apache.org/proper/commons-jxpath.

JXPath is an interpreter of an expression language called XPath.  JXPath applies XPath expressions to graphs of Java objects.

XPath was standardized by W3C and is used in both XSLT and XPointer.

JXPath supports JavaBeans, Java Collections, Maps etc. It also works with DOM objects, the same way XPath was originally intended.  A DOM node can be the root of the graph, or a property value, collection element, variable value.  XML files can be loaded as needed during the traversal of JXPaths.

JXPath supports such operations as:

  • Graph traversal:
    • Retrieving property values by name
    • Retrieving map elements by key
    • Retrieving collection elements by the index or search criteria
  • Search in object graphs.
  • Basic logical, arithmetic, string and collection manipulations
  • Java method calls and object construction
  • Pools of variables
  • Extension functions

Consider this example:

Address address = (Address)JXPath.getValue(vendor,
         "locations[address/zipCode='90210']/address");

This XPath expression is equvalent to the following Java code:

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

Primary applications of JXPath are in scripting: JSP and similar template/script based technologies.

 
 
   JEX

JEX is a universal set of APIs for expression languages. Individual expression languages function as plug-ins. You use the same set of APIs to invoke any of them.

JEX can be "multilingual". It can figure out which expression language to use by looking at the expression's prefix. For example, if the expression is "xpath://address[@name='John']", JEX will invoke a XPath processor. If the expression is "javascript:findAddress('John')", JEX will invoke a Javascript processor. You can also set a default language, in which case you won't have to use prefixes.

Learn more.

 
 
   Enum

An powerful early implementation of Enum for Java. It predated the official introduction of the enum in Java 5 in 2004

Unlike its ancestors (C and C++)  Java does not support the notion of an enum, which is a data type all values of which are explicitly enumerated in the type definition.

That said, an object-oriented implementation of the concept of enum in Java can be much more powerful than C-style enum.

The Enum framework (in reality, the whole framework is a single class) proves that by providing extensive functionality that includes:   

  • Either an integer or string value or both for each constant
  • A human-readable description that can be easily internationalized.  An enum type is automatically associated with .properties files containing labels of constants in specific languages.
  • All constants of an Enum can be (but don't have to be) loaded from a .properties file.

Every Enum type is represented by a separate class extending the Enum abstract class (see API)

Of course, Enum is free and comes with the source code.

Please read a more detailed description of Enum