java - GWT Interface woes : Breaking on exception: TypeError: Cannot read property 'getRestWrapper' of undefined -


i writing gwt app using libgdx & having difficulties loading correct rest library @ runtime.

in core gradle project, have defined "restwrapper" interface grants access platform specific rest functions (in case of gwt, restygwt). when html5 launcher run, passes it's implementation libgdx game class in core project.

however when html5 project run error raised compiled js:

breaking on exception: typeerror: cannot read property 'getrestwrapper' of undefined 

the issue appears first interface (platformwrapper). understand gwt compiler bit ham-fisted when comes interfaces, should taking different approach running gwt specific code core project?

calling code (in core project:)

usersessiontoken token =client.getplatform().getrestwrapper().getrestlogin().attemptlogin(usernamebox.gettext(),passwordbox.gettext()); 

interfaces (in core project):

plaformwrapper

public interface platformwrapper {  public restwrapper getrestwrapper();.... 

restwrapper

/* platform independent wrapper rest services */  public interface restwrapper {  public restlogin getrestlogin();.... 

implementations (in html5 project):

platformwrapper (top level)

public class gwtwrapper implements platformwrapper {  public restwrapper gwtrestwrapper;  public gwtwrapper(){     gwtrestwrapper = new gwtrestwrapper(); }  @override public restwrapper getrestwrapper() {     return gwtrestwrapper; } 

gwtrestwrapper:

public class gwtrestwrapper implements restwrapper { public restlogin restlogin; public restportal restportal; public restregister restregister;  public gwtrestwrapper(){     restlogin = new gwtrestlogin(); //gwtrest logic      restregister = new gwtrestregister();     restportal = new gwtrestportal();        }   @override public restlogin getrestlogin() {     return restlogin; } 

cheers.

working change:

public applicationlistener getapplicationlistener () {           setloadinglistener(new loadinglistener(){              @override             public void beforesetup() {                 // todo auto-generated method stub              }              @override             public void aftersetup() {                 // todo auto-generated method stub                 wrapper = new gwtwrapper();                 client.setplatform(wrapper);             }          });             return client; 

Comments