Hi Jakub,

Yes, that is correct - Clojure interop only deals with raw classes, it has
no concept of generics. Java is the way to go here.

Cheers,
Colin

On 5 August 2016 at 09:28, Jakub Holý <[email protected]> wrote:

> I need to implement the interface javax.websocket.
> MessageHandler.Whole<String> - the type parameter is important since the
> Java code uses reflection to check
> <https://github.com/tyrus-project/tyrus/blob/373fab2f47ff06167d6ced8475085004ffbbfd5a/core/src/main/java/org/glassfish/tyrus/core/ReflectionHelper.java#L528>
> whether the result is instanceof java.lang.reflect.ParameterizedType.
>
> I believe I cannot use proxy or any other available Clojure mechanism as
> they do not support generics. Is that correct?
>
> I believe that the only (and best) solution is to implement the interface
> in Java and then possibly extend the resulting class:
>
> public class TextMessageHandler implements 
> javax.websocket.MessageHandler.Whole<String>
> {
>     public void onMessage(String message) {
>     }
> }
> ----
> (proxy [TextMessageHandler] []
>     (onMessage [msg]
>       (println "received message(" (.getClass msg) "):" msg)))
>
>
> Correct?
>
> Thank you!
>
> Cheers, Jakub Holý
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to