[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 558
  • Last Modified:

How to return a primitive or object value from a static method using Drools Rule Engine?

I have a static calculation method (many more methods like this one) like:

public class ShareCalculator{
    public static double calculateDailyDecDivRate(DeclaredDividend pDeclaredDiv,  
             FundProductDeclaredDividend pFundProductDeclaredDividend)throws FMSCalculationException{

             ...... verify many if, then else conditions ,, etc....
             then return the double value
    }
}

    I plan to utilize Drools Rule Engine ...
    Then my real question is how DO I RETURN THE Primitive or Object value from this method to a calling
    class?

    Does my question make sense?
    Most of the examples I saw on Drools mostly deal with Object with getter/setter type !!!
    How to I use a class with static methods to return values?

    Thanks much.
    _Esam
0
_Esam
Asked:
_Esam
1 Solution
 
schybertCommented:
What version of Drools are you using? In 4.0 you can imort your static methods as functions like this:

import function your.package.ShareCalculator.calculateDailyDecDivRate

Then you can use the method as a function using it's name like this:

when
    eval( true )
then
    System.out.println( calculateDailyDecDivRate( yourInput) );
end

Hope this helps...
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now