Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using enums in jython

Trying to use a Java Enum in Jython but I can't figure out how to use them.

when importing I see the enum listed as BotInterface$MOVE so I've put down the line

from amazebot2012.BotInterface import MOVE

In Java I would normally just use it as

bot.move(MOVE.FORWARD);
bot.move(MOVE.BACKWARD);

What is the Jython equivalent once I've imported it?

Trying bot.move(MOVE.FORWARD) gives me the error:

Undefined variable from import: FORWARD

like image 716
Nebri Avatar asked Nov 12 '22 17:11

Nebri


1 Answers

Your import and reference seem correct.

I suspect this is a bug in your editing environment, if you're using PyDev/Anapta:

http://jira.appcelerator.org/browse/APSTUD-7502

like image 59
Matt Hillsdon Avatar answered Dec 14 '22 21:12

Matt Hillsdon