Re: Nasty java interop problem -- ideas?

2011-08-12 Thread Oskar Kvist
Oh yes, of course. Why didn't I think of that? For some reason,
implementing 2 interfaces never occurred to me. :P

On Aug 12, 4:48 pm, David Powell  wrote:
> > The simplest so far seems to be to use gen-interface to create a
> > subinterface of Controller with all the methods I need, or gen-class.
> > But that would require AOT compilation. Can I get away without it?
>
> Can you use definterface to create an interface with your methods on, and
> then deftype or reify to implement the methods from the Controller type, and
> from your custom interface.
>
> --
> Dave

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Nasty java interop problem -- ideas?

2011-08-12 Thread David Powell
>
>
> The simplest so far seems to be to use gen-interface to create a
> subinterface of Controller with all the methods I need, or gen-class.
> But that would require AOT compilation. Can I get away without it?
>

Can you use definterface to create an interface with your methods on, and
then deftype or reify to implement the methods from the Controller type, and
from your custom interface.

-- 
Dave

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Nasty java interop problem -- ideas?

2011-08-12 Thread Oskar Kvist
Hi!

I have the following problem. I'm using a Java lib for making GUIs.
One lays out the GUI in XML, then uses a Controller (Listener type
thing) to do stuff. For example, in the XML one might have
onClick="doSomething()". And then reflection is used to find the
method of the controller instance.

But doSomething() is not a method of the interface Controller. The
Controller interface only declares a few very basic methods. So, I
need to pass an object to the GUI that implements Controller, but also
has additional methods.

With proxy, I learend recently, I can not define additional methods,
outside the interface.

What is the most painless way to create an object that implements a
specific interace, but also has additional methods?

The simplest so far seems to be to use gen-interface to create a
subinterface of Controller with all the methods I need, or gen-class.
But that would require AOT compilation. Can I get away without it?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en