RE: JESS: [EXTERNAL] Access public enum inside of a class

"Friedman-Hill, Ernest" <[email protected]> Wed, 7 Dec 2011 22:10:37 +0000
Newsgroups gmane.comp.java.jess
Message-ID <[email protected]>
Nested enums, like nested classes, actually secretly have a name like "UnitType$UnitTypes". I haven't tried this specifically for enums, but I suspect this would work:

engine.executeCommand("(import eisbot.proxy.types.UnitType$UnitTypes)");

________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Hunter McMillen
Sent: Wednesday, December 07, 2011 4:27 PM
To: jess-users
Subject: JESS: [EXTERNAL] Access public enum inside of a class

Hi everyone,

I am trying to use an enum from one of my Java classes inside of Jess. I read a forum post that said I could use the (import <enum-name>) feature to import enums into Jess, but that only seems to work when the enum is itself in a separate file.

I have a class called UnitType, inside of it there is a public enum called UnitTypes where all of the UnitTypes in my game are listed. In Java to access this I would use UnitType.UnitTypes.<Element_in_enum> to get to the enum