[rules-users] Some basic queries
Wolfgang Laun
wolfgang.laun at gmail.com
Thu Aug 4 06:33:23 EDT 2011
2011/8/4 Gaurav Silakari <gaurav.silakari at tcs.com>
> Hi,
>
> I have some queries on Drools. These might be very basic but I need to get
> them cleared.
>
> 1) Is it possible to bind the constructor name of java class(provided in
> the 'import' syntax) with a bind variable in LHS of the rule
>
Whatever would you need the binding for? MyClass.class.getName() is also the
constructor's name.
> 2) Is it possible to call a parameterised (single parameter) method of a
> class (by giving class reference as bind variable and class being declared
> in 'import' syntax ) in LHS of the rule
>
If the Class object is an attribute of some fact it can be bound and you can
use
reflection to call the method. This could be written as a DRL function.
> 3) Is it possible to call a parameterised method (with single parameter) in
> the RHS of the rule (The method would be pertaining to the class imported in
> the 'import' syntax and method name being invoked through the bind variable
> reference )
>
Assuming the method name (or the Method object) comes from a field in some
fact, it can be bound to a variable. On the RHS you proceed as in Java.
-W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110804/f6866cef/attachment.html
More information about the rules-users
mailing list