[rules-users] Calling a method with varargs

janders andersenjason+forum at gmail.com
Tue Apr 12 12:53:56 EDT 2011


Hey all, I've got a rule in a DRL file that I'm trying to call an object
method that contains a varargs parameter.

The method signature looks like so:
public void addMessage(int displayPriority, String messageFormat, Object...
messageArgs) {


The rule looks like so:

rule "Notice Quantity"
no-loop
when
    $notice : Notice(quantity > 0);
then
    $explanation.addMessage(1, "%s Quantity = %,d", $notice.dispositionCode,
$notice.quantity);
end


When I run this rule base, I get this runtime error from the Drools engine:


Caused by: [Error: unable to resolve method:
com.package.TriggerExplanation.addMessage(java.lang.Integer,
java.lang.String, java.lang.String, java.lang.Integer) [arglength=4]]
[Near : {... Unknown ....}]


This feels very much like either the MVEL engine or Drools can't resolve a
method with varargs. I found nothing in any of the documentation and the
only thread on these forums that references varargs was a few years old.

Can anyone tell me if Drools does/does not support method calls with
varargs? Doing this without varargs is going to be a galactic pain in the
butt.


Thanks!


Jason

--
View this message in context: http://drools.46999.n3.nabble.com/Calling-a-method-with-varargs-tp2812191p2812191.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110412/5e321a89/attachment.html 


More information about the rules-users mailing list