Trying to implement Drools rules into my project and I am trying to convert lot of if-else into drools rules, but I am not sure how to put else condition in drools. My scenario is like this:
if(value.equals("java.lang.Integer")) {
//Put value into pojo
} else if(value.equals("java.lang.Float")) {
}
// Similar if-else for other data type
else {
//Do some action (if it doesn't satisfy all other condition)
}
My current content of drl file is like this:
rule "When Method Parameter is java.lang.Integer"
when
object.getValue().eqals("java.lang.Integer")
then
#Set value to another pojo
end
rule "When Method Parameter is java.lang.Float"
when
object.getValue().eqals("java.lang.Float")
then
#Set value to another pojo
end
rule "Rules if all of the above condition fails"
# is it possible to have rule just like else, if all
# of above condition fails, this rule should execute
end
Now I want an conditon, which should be executed if all of the above condition fails. Is this possible to do this using drools? That else part should execute if all of the above condition fails, I tried search and found out currently drools doesn't support else conditon. If this is the case how do I implement this type of scenario? Can anyone please guide me since I am beginner to drools.