You could also use ${empty(outputDir)}, or ${outputDir == null}, which are both identical in meaning to ${empty outputDir}.

Jelly uses the Jexl Expression Language, which is a superset of JSTL (Java Standard Tag Library). To quote from JSTL in Action,

"The empty operator determines whether a collection or string is empty or null. For instance, ${empty param.firstname} will be true only if a request parameter named firstname is not present. JSTL expressions can also compare items directly against the keyword null, as in ${param.firstname == null}, but this is an advanced use."

Although Jelly is not always in a web context (ie, doesn't have the param implicit object), the same rules apply. In addition, to quote from the jexl home page (http://jakarta.apache.org/commons/jexl.html):

Jexl has extended the JSTL in a few ways :
- Support for invocation of any accessible method (see example above).
- Added a general size() method, which works on String, returning length, Map, returning # of keys, and List and arrays, returning the number of elements.
- Optional syntax for the 'empty' function : empty(obj)
- Misc : '+' has been overloaded to be use as a String concatenation operator


The "invocation of any accessible method" means that you can call ${object.getProperty()}, and it will be the same as ${object.property}, or ${object.setProperty(someOtherObject)}. You can also call methods that do not correspond to properties, such as ${someString.endsWith(otherString)}.

Strongly recommend reading up on Jexl and JSTL.


Matt


Vikas Phonsa wrote:

Hi Guys,

I have this line in one of the jelly script in a maven plugin. I don't know
jelly but have checked out its major tags. Could you pls help me understand
this:

<j:if test="${empty outputDir}">

I undertand j:if test

But in ${empty outputDir}" does empty refers to some inbuilt function of
checking the outputDir or what ?

Or is it supposed to be some function written somewhere in the jelly script
that I'm using.

Please guide

Thanks

Vikas




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to