Aaron Gadberry

Help – v. helped, help·ing, helps

Was this site helpful?
My Amazon.com Wishlist

JExel – Java Based Expression Language Parser

26th July 2007 - By Aaron Gadberry

I have published a pet project of mine online recently. After looking at many different project hosting sites I resolved on google code. It seems to have a great interface and amount of space available.

The project is called JExel, and is a Java based expression language parser. It’s not complex to utilize, and can be the perfect plugin library for usage in your larger Java application. JExel parses string expressions to an object result. It comes with native boolean, math, string and date functionality.

A boolean expression utilization would look something like Expression.evaluateToBoolean("true AND false"); and, in this case, would return a new Boolean(false);.

Of course there are also included methods evaluateToDouble(String) and evaluateToString(String).

Additionally there is a plain evaluate(String) method that returns an Argument. You can then call getObject() on the resulting Argument and get the actual Object result.

You can expand on the included operators, and write your own to accomplish your own task. You can provide a Resolver which can resolve string variables found in the expression via your own needs. Say you had an expression like Expression.evaluateToDouble("path/to/variable + otherVariable");. This means if you provide a resolver then you can gain variable resolution relevant to your own project. Maybe path/to/variable is translated into “6” and otherVariable is translated into “4”. Then the result would be 10.

Have fun! Start Exploring JExel

2 Responses to “JExel – Java Based Expression Language Parser”

  1. Bill Says:

    How can I get a commercial licence for this?

  2. Aaron Says:

    Bill,

    I’ll be happy to send you an email with all the details. Anyone else interested can email me at the address found on the About Me page or on the project’s page.

    Thanks for your interest!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>