Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
guidelines:adding_gamebots_message_to_pogamut_java [2012/02/07 17:41] martin.cerny |
guidelines:adding_gamebots_message_to_pogamut_java [2012/02/07 17:43] martin.cerny |
||
---|---|---|---|
Line 299: | Line 299: | ||
</ | </ | ||
+ | |||
+ | ===== Creating the Guice module ===== | ||
+ | |||
+ | This is easy, an example (from the SpyVsSpy project) follows: | ||
+ | |||
+ | <code java> | ||
+ | import cz.cuni.amis.pogamut.spyvsspy.communication.SpyVsSpyYylex; | ||
+ | import com.google.inject.AbstractModule; | ||
+ | import cz.cuni.amis.pogamut.base.communication.parser.IWorldMessageParser; | ||
+ | import cz.cuni.amis.pogamut.udk.bot.IUDKBotController; | ||
+ | import cz.cuni.amis.pogamut.udk.communication.parser.IUDKYylex; | ||
+ | import cz.cuni.amis.pogamut.udk.factory.guice.remoteagent.UDKBotModule; | ||
+ | |||
+ | |||
+ | public class SpyVsSpyBotModule< | ||
+ | { | ||
+ | |||
+ | public SpyVsSpyBotModule(Class<? | ||
+ | super(botControllerClass); | ||
+ | } | ||
+ | | ||
+ | | ||
+ | @Override | ||
+ | protected void configureModules() { | ||
+ | super.configureModules(); | ||
+ | addModule(new AbstractModule() { | ||
+ | |||
+ | @Override | ||
+ | public void configure() { | ||
+ | //bind our parser instead of the built-in one | ||
+ | bind(IUDKYylex.class).to(SpyVsSpyYylex.class); | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | } | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ |