commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Grimes <frankgrime...@yahoo.com>
Subject OGNL expression validation
Date Wed, 12 Dec 2012 20:18:52 GMT
Hi All,

I was wondering if there was a way to determine if a given expression is valid for a particular
type.
i.e. if the properties/methods specified actually exist.

Something along the lines of Ognl.isValidExpression(Root.class, "root.branch.leaf") 

e.g.

class Branch {
  public Leaf leaf;
}
class Root {
  public Branch branch;
}

Note that I don't need/want to pass in an instance to evaluate getValue on, I just want to
know if "root.branch.leaf" is valid.
I tried passing in a new instance of the type but then I was getting the following error:

ognl.OgnlException: source is null for getProperty(null, "leaf")

Thanks,

Frank Grimes
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message