Trustin Lee wrote:
On 10/29/07, Niklas Therning <[EMAIL PROTECTED]> wrote:
Any new idea on event types? :)
I've been thinking about how one could use the IoEventType enum. One
idea is to change the @Handler annotation into a meta annotation. Other
annotations which have been annotated with @Handler can be used by the
statemachine module to build the StateMachine. Maybe something like:
@Handler(IoEnumType.class, useNullForWildcard = true)
public interface @MinaHandler {
IoEnumType on() default null
String next()
String in()
}
The @MinaHandler annotation must have the on, in, next parameters or
StateMachineFactory will complain. StateMachineFactory will have to look
at all annotations in the handler objects and see if they have been
annotated with @Handler.
Uh... It sounds too complex?
Yes, I agree, it sounds rather complex. :-)
Alternatively StateMachineFactory takes MinaHandler.class as a
parameter. Maybe that's a better idea?
Could you provide me some example code if StateMachineFactory takes
MinaHandler.class as a parameter? Isn't MinaHandler a method
annotation? How can I specify an annotation as a parameter?
I'm not talking about generics, rather a constructor parameter. It
should be possible to specify MinaHandler.class
as a constructor argument. An annotation is compiled into a .class just
like any other class or interface.
It would be cool if one could use a custom @Handler annotation because
that would make it possible to use enums not only for the events but
possibly also for the states instead of strings. I'll see if I can come
up with an example.
/Niklas