[rules-users] Property access on Java Beans (POJO's)

Mark Proctor mproctor at codehaus.org
Tue Nov 15 14:27:55 EST 2011


MVEL has this functionality and is far better than SpringEL. see:
http://www.theserverside.com/feature/Adding-MVEL-to-the-Java-Developers-Toolkit

Being able to inject a root context object would make no sense, and
actually we already do this as the object being evaluated is the root
context object. We already inject all globals and static methods
(functions) so you can use that to make variables and functions available.

Mark

On Tue, Nov 15, 2011 at 3:25 PM, kapokfly <ivan.jiang.ww at foxmail.com> wrote:

> This is what is documented
> /"
> Any bean property can be used directly. A bean property is exposed using a
> standard Java bean getter: a method getMyProperty() (or isMyProperty() for
> a
> primitive boolean) which takes no arguments and return something. For
> example: the age property is written as age in DRL instead of the getter
> getAge():
>
> Person( age == 50 )
>
> // this is the same as:
> Person( getAge() == 50 )
> Drools uses the standard JDK Introspector class to do this mapping, so it
> follows the standard Java bean specification.
> "/
>
> Apparently this is from Spring:
> "The StandardEvaluationContext is where you may specify the root object to
> evaluate against via the method setRootObject() or passing the root object
> into the constructor. You can also specify variables and functions that
> will
> be used in the expression using the methods setVariable() and
> registerFunction(). The use of variables and functions are described in the
> language reference sections Variables and Functions. The
> StandardEvaluationContext is also where you can register custom
> ConstructorResolvers, MethodResolvers, and PropertyAccessors to extend how
> SpEL evaluates expressions. Please refer to the JavaDoc of these classes
> for
> more details.
> "
>
> Can drools do the same to allow custom resolver, which would be quite
> useful
> in our use cases.
>
> Ivan
>
>
> -----
> Ivan, your Panda, forever
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Property-access-on-Java-Beans-POJO-s-tp3509973p3509973.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111115/3d3496a0/attachment.html 


More information about the rules-users mailing list