mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trustin Lee" <trus...@gmail.com>
Subject Re: Type Safety in StateMachineProxyFactory
Date Sat, 01 Dec 2007 12:01:10 GMT
Hi Cameron,

On Dec 1, 2007 4:32 AM, Cameron Taggart <cameron.taggart@gmail.com> wrote:
> I'm been looking at the tapedeck example using the state machine.  I
> think the proxy factory could be enhanced to return the type of the
> class passed in.  This is pretty easy to do:
>
> //    public static Object create(Class<?> iface, StateMachine sm,
> StateContextLookup contextLookup) {
> //        return create(new Class[] { iface }, sm, contextLookup);
> //    }
>     @SuppressWarnings("unchecked")
>     public static <T> T create(Class<T> iface, StateMachine sm,
> StateContextLookup contextLookup) {
>         return (T) create(new Class[] { iface }, sm, contextLookup);
>     }
>
> This removes the need to have a cast in people using the that method
> such as the example:
> org.apache.mina.example.tapedeck.Main creatIoHandler()
>
> wdyt?

Thank you for the nice idea.  I've just made the change you suggested.

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Mime
View raw message