Generics and interfaces

7 views
Skip to first unread message

selckin

unread,
Oct 23, 2008, 4:04:24 PM10/23/08
to gxp-users
Hey,

Is there a way to define what type you want when implementing an
interface?

I have something like:

<gxp:interface name="RowFormatter">
<gxp:typeparam name='E'/>
<gxp:param name='row' type="E"/>
</gxp:interface>

<gxp:template name='FooRowFormatter' >
<gxp:implements interface='RowFormatter'/>
</template>

"<gxp:implements interface='RowFormatter{Foo}'/>" results in "no such
gxp:interface RowFormatter{Foo}"

Thanks

harryh

unread,
Oct 23, 2008, 4:15:28 PM10/23/08
to gxp-users
Interesting, this is not a case I had considered. You are correct
that it is not currently possible to do exactly what you are asking
for. I have created a bug:

http://code.google.com/p/gxp/issues/detail?id=4

to track the problem, and will look into fixing it (you are, of
course, welcome to submit a patch to fix this as well if you would
like to delve into the internals of the compiler).

A workaround that you can use today:

<gxp:implements java:interface='RowFormatter{Foo}'/> will work fine
(make sure to have xmlns:java='http://google.com/2001/gxp/code/java'
in your root element to define the java namespace). You won't get an
error from the GXP compiler if the parameters of your template don't
match the parameters of your interface, but you will get an error from
the java compiler during java compilation.

-harryh
Reply all
Reply to author
Forward
0 new messages