Chris: thank you very much: It didn't occured that to me and just tried and 
worked fine! Will use this pattern, thanks again. !

On Friday, September 7, 2012 1:05:46 PM UTC-3, Chris Price wrote:
>
> Sebastián: You may already be aware of this, but when I first looked 
> into this problem it was a subtlety I had overlooked. 
>
> If you have - 
>
> interface A { void a();} 
> interface B extends A { void b(); } 
> interface C extends A { void c(); } 
>
> You can't have - 
>
> final class BImpl implements B { 
>   void a() { ... } 
>   void b() { ... } 
> } 
> final class CImpl implements C { 
>   void a() { ... } 
>   void c() { ... } 
> } 
>
> Because as has been pointed out "a" would be implemented twice. 
> However, you can have - 
>
> final abstract class AImpl implements A { 
>   void a() { ... } 
> } 
> final abstract class BImpl extends A implements B { 
>   void b() { ... } 
> } 
> final abstract class CImpl extends A implements C { 
>   void c() { ... } 
> } 
>
> Because in this case "a" is only implemented once. 
>
> It may not help but when I was wrapping a third-party lib, I found the 
> above pattern worked almost everywhere. 
>
> Chris 
>
> On Fri, Sep 7, 2012 at 4:53 PM, Alain Ekambi 
> <jazzma...@gmail.com<javascript:>> 
> wrote: 
> > " Your approach however would make this kind of Java API much more 
> > confortable to Java users " 
> > 
> > Is nt it why you are wrapping YUI in the first place ? To make it 
> > confortable for Java users ? 
> > 
> > 
> > 2012/9/7 Sebastián Gurin <sebast...@gmail.com <javascript:>> 
> >> 
> >> Thanks Paul, Nino and Thomas 
> >> 
> >> Paul: yes I suppose that too, but interfaces do not implement methods, 
> so 
> >> I thought it is strange. 
> >> 
> >> Nino: I do not want to make object wrapping as you suggested because I 
> >> want my library user's to use the overlay types directly for a 
> zero-overhead 
> >> API. Your approach however would make this kind of Java API much more 
> >> confortable to Java users. 
> >> 
> >> Thomas, thanks. Yes I'm using .cast() a lot, it is much more 
> confortable 
> >> than java casting. Also I have designed this YUI java API to be the 
> most 
> >> similar to the native javascript API. So code using mine YUIGWT will 
> look 
> >> strange to java programmers, for example, a js literal object 
> definition : 
> >> 
> >> in javascrpt: 
> >> 
> >> var p = {name: "seba", age: 28} 
> >> 
> >> in java: 
> >> Person p = Person.create().name("seba").age(28); 
> >> 
> >> 
> >> On Thursday, September 6, 2012 3:22:16 PM UTC-3, Sebastián Gurin wrote: 
> >>> 
> >>> Hi all. I'm writing a lot of GWT overlay types for my new project 
> YUIGWT 
> >>> - http://code.google.com/p/yuigwt/. I'm creating a nice and rich java 
> >>> hierarchy of overlay types there. 
> >>> 
> >>> Today I discovered that it is not good to let overlay types (extends 
> >>> JavaScriptObject implement interfaces because it seems that for a 
> certain 
> >>> interface, no more than one overlay type can implement its methods. 
> The 
> >>> error in question is pasted below, but this arrises a big question for 
> me: 
> >>> 
> >>> While I understand perfectly what the error means, I would really 
> >>> appreciate if somebody can explain me the reasons behind this nasty 
> >>> restriction ? ?? 
> >>> 
> >>>     [ERROR] [org.sgx.yuigwt.YuiGwtTestOnline] - Line 9: Only one 
> >>> JavaScriptObject type may implement the methods of an interface that 
> >>> declared methods. The interface 
> (org.sgx.yuigwt.yui.yql.api.YQLQueryResult) 
> >>> is implemented by both (org.sgx.yuigwt.yui.yql.api.desc.DescResult) 
> and 
> >>> (org.sgx.yuigwt.yui.yql.api.wheather.forecast.WheatherForecastResult) 
> >>> 
> >>> Thanks in advance. 
> >> 
> >> -- 
> >> You received this message because you are subscribed to the Google 
> Groups 
> >> "Google Web Toolkit" group. 
> >> To view this discussion on the web visit 
> >> https://groups.google.com/d/msg/google-web-toolkit/-/GAl_l1hUSQkJ. 
> >> 
> >> To post to this group, send email to 
> >> google-we...@googlegroups.com<javascript:>. 
>
> >> To unsubscribe from this group, send email to 
> >> google-web-toolkit+unsubscr...@googlegroups.com <javascript:>. 
> >> For more options, visit this group at 
> >> http://groups.google.com/group/google-web-toolkit?hl=en. 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Google Web Toolkit" group. 
> > To post to this group, send email to 
> > google-we...@googlegroups.com<javascript:>. 
>
> > To unsubscribe from this group, send email to 
> > google-web-toolkit+unsubscr...@googlegroups.com <javascript:>. 
> > For more options, visit this group at 
> > http://groups.google.com/group/google-web-toolkit?hl=en. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/8fm0bbM9lWYJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to