On 28/01/2014, SrjTx <clickthex(a)yahoo.com> wrote:
I have a class that I declared final, has a private constructor, has
static members and methods.
Some of its members are static instance of classes.
In KIE-WBI added a global of that type with name X
You can't use a global that has a type X as you describe it, as you won't
be able to instantiate an X object if the constructor is private. (OK, you
could have a static getInstance method according to the singleton
pattern - but the use of an object where everything in the class
is static is rather doubtful.)
When I try to make a call on X.foo(), I get a null pointer exception.
Well, if there's no object you haven't initialised the global.
that x.foo() calls y.foo(), where y is a static member of X.
I've read some posts that a global has to be static, am I stretching, what
it means for a global to be static?
I don't know where you've read that, but do read the documentation first.
I am guessing I need to write some java code that will create an instance
X and inject into working memory?
You are guessing, and you are guessing wrong.
kSession.setGlobal( "theDRLnameOfTheGlobal", new XbutNotAsYouDescribedIt() )
I was hoping to be able to create this
object within either the drools or SY framework.
I have googled and be reading on this for quite a bit now, but I think I
have succeeded only in confusing myself.
Any help greatly appreciated.
Documentation, 7.5.2, global - about all you need to know.
View this message in context:
Sent from the Drools: User forum mailing list archive at Nabble.com
rules-users mailing list