GWT-Exporter and Google-GIN

76 views
Skip to first unread message

danci...@gmail.com

unread,
May 29, 2013, 2:14:19 PM5/29/13
to gwtex...@googlegroups.com
I'm trying to use GWT-Exporter on an application that uses Google-GIN for dependency injection. 
So far, from what I've seen, GIN definitely complicates things. I'm wondering if the GIN generator and GWT-Exporter generator are incompatible. Or maybe the order of the generators matters? 
Has anyone tried to do this? 

Manuel Carrasco Moñino

unread,
May 29, 2013, 2:20:26 PM5/29/13
to gwtex...@googlegroups.com
You should not inject classes implementing Exportable because gin uses by default GWT.create and will call the exporter generator.

By convention, you should export your classes in your onModuleLoad, either calling the exportAll() method or calling GWT.create with each class you want to export.

If you need inject with gin classes implementing Exportable, it should be better that you use ExportOverlay classes or gin providers.

- Manolo


--
Has recibido este mensaje porque estás suscrito al grupo "gwtexporter" de Grupos de Google.
Para anular la suscripción a este grupo y dejar de recibir sus correos electrónicos, envía un correo electrónico a gwtexporter...@googlegroups.com.
Para obtener más opciones, visita https://groups.google.com/groups/opt_out.
 
 

danci...@gmail.com

unread,
Jun 5, 2013, 11:37:42 AM6/5/13
to gwtex...@googlegroups.com
OK I've managed to get something working by refactoring my classes so that I can construct them via GWT.create and now see the exported classes via fully qualified package: com.company.app.myclass 

So now I can call any exported static methods like:
com.company.app.myclass.exampleStaticMethod()

I can even create an instance by calling the constructor from javascript:
myInstance = com.company.app.myclass() 

But I can't seem to access any instance methods I've exported in my class.
myInstance.exampleInstanceMethod()
-- doesn't exist.

Is there something I'm missing? Do I need to do something more than @Export the class and @Export its exampleInstanceMethod ?

Manuel Carrasco Moñino

unread,
Jun 5, 2013, 1:37:06 PM6/5/13
to gwtex...@googlegroups.com
Could you send some basic code (java and js) ?

danci...@gmail.com

unread,
Jun 5, 2013, 4:02:14 PM6/5/13
to gwtex...@googlegroups.com
Wow. I must be tired. Just noticed I wasn't using "new" to create my instance:
myInstance = new com.company.app.myclass() 
Then it all works as expected.
So move along, nothing to see here. GWT-Export works wonderfully :)

Manuel Carrasco Moñino

unread,
Jun 5, 2013, 4:11:54 PM6/5/13
to gwtex...@googlegroups.com
Yep, that is an example of typical errors in JS, and GWT is just a way to avoid those kind of errors.


- Manolo


Reply all
Reply to author
Forward
0 new messages