[rules-users] How to compare to Class type in LHS??

Felipe Piccolini felipe.piccolini at bluesoft.cl
Tue Jul 24 15:22:04 EDT 2007


Hi,

    Im trying to compare a field to a Class type but when parsing I  
get NPE and when I debug,
the constraint is a ReturnValueConstraint but the  
restriction.getRequiredDeclarations()
return a Declaration[] array initializated, but empty, so I can't get  
the declaration evaluated...
I needed because I'm working on a kind of parser for the rules for  
analisys and testing... but using
the already parsed package.

Here is a pseudo rule for test...

rule "Test A"
	when
		$mf: MyFact(clazz == (SomeClass.class))
	then
		System.out.println("Test A: OK");
end

Actualy, the rule compiles (with the NPE output, not stackTrace, just  
the java.lang.NullPointerException,
and it works fine.. I mean I get "Test A: OK" as output, but cant get  
the SomeClass.class reference when I
look into the debugger.

Is this the right way to compare clases? if not, whats the right way?  
(Im trying to not do == "SomeClass")

Felipe Piccolini M.
felipe.piccolini at bluesoft.cl




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070724/68a5848d/attachment.html 


More information about the rules-users mailing list