Skip to main content

[jsr356-experts] Re: [jsr356-users] Re: Some API suggestions from EDR

  • From: Scott Ferguson < >
  • To:
  • Subject: [jsr356-experts] Re: [jsr356-users] Re: Some API suggestions from EDR
  • Date: Thu, 25 Oct 2012 15:57:07 -0700

On 10/25/12 3:37 PM, Justin Lee wrote:
" type="cite">I'm clearly missing something here.  How exactly would we be able to tell what they implemented?  Because this test won't even compile:

public class Handler {
public interface MessageHandler<T> { }

public static void main(String[] args) throws Exception {
MessageHandler<String> handler = new MessageHandler<String>() {};

System.out.println(handler instanceof MessageHandler<String>);
}
}

So when a frame comes in, how are we going to decide which callback to call?

We can use reflection and generics filling.

  for (Type t : handler.getClass().getGenericInterfaces()) {
    System.out.println("  interface: " + t);
  }

  interface: qa.Test.qa.Test$MessageHandler<java.lang.String>

It's a bit more complicated than instanceof, but not too terrible. It might make matching with Decoders more logical as well.

By the way, it seems a mismatch that the MessageHandler is assigned in the session, but the decoder is assigned in the EndpointConfiguration. I'd think their config should be at the same place (and setDecoders set in the same place as setEncoders is.)

-- Scott




[jsr356-experts] Some API suggestions from EDR

Danny Coward 10/25/2012

[jsr356-experts] Re: Some API suggestions from EDR

Justin Lee 10/25/2012

[jsr356-experts] Re: Some API suggestions from EDR

Danny Coward 10/25/2012

[jsr356-experts] Re: Some API suggestions from EDR

Justin Lee 10/25/2012

[jsr356-experts] Re: [jsr356-users] Re: Some API suggestions from EDR

Scott Ferguson 10/25/2012
 
 
Close
loading
Please Confirm
Close