Le vendredi 01 juin 2007 à 11:19 +0200, Julien Vermillard a écrit : > Le vendredi 01 juin 2007 à 10:51 +0200, Niklas Therning a écrit : > > Julien Vermillard wrote: > > > Le samedi 26 mai 2007 à 09:44 +0200, Niklas Therning a écrit : > > > > > >> My main motivation for starting mina-sm was that I wanted to express my > > >> state machine in pure Java. It's by no means finished so any suggestions > > >> for improvements would be most welcome. > > >> > > >> If you want more info about mina-sm you could check out the tutorial I'm > > >> working on, > > >> http://cwiki.apache.org/confluence/display/MINA/Introduction+to+mina-sm. > > >> Please be aware that it's not finished yet. > > >> > > >> > > > > > > Nice tutorial, you sohuld add a like in the documentation page. > > > > > > I got a little suggestion : > > > why not use Enum {} for defining the list of states in place of > > > Strings ? > > > in place of : > > > > > > @State public static final String EMPTY = "Empty"; > > > @State public static final String LOADED = "Loaded"; > > > @State public static final String PLAYING = "Playing"; > > > @State public static final String PAUSED = "Paused"; > > > > > > public enum State {EMPTY,LOADED,PLAYING,PAUSED}; > > > > > If that was possible it would have been so great! Unfortunately, to my > > knowledge, the enum has to be known at the time mina-sm is compiled. > > :-( Can you think of a way to get around it? > > > > If you call > Object.getClass.getClasses() > you get all the public classes defined in this class > You can loop testing the .isEnum(); method and find the Enum called > "State". > > Could it be enought ? >
Replying to myself, apparently you can't @anotate a vaule of an Enum, so you won't be able to parametrize your different state like you did with static Strings :( Julien
