jsonx-org / java

Reference implementation of the JSONx specification for the Java platform, including encoding, decoding, processing, validation, and binding.
https://www.jsonx.org/java/
MIT License
49 stars 14 forks source link

GWT Support? #4

Closed adligo closed 12 months ago

adligo commented 5 years ago

Does this support GWT / Java compiling to Javascript?

safris commented 5 years ago

Hi @adligo, what facet of the JSONx Framework for Java are you referring to with regard to GWT support? The top of the README.md gives a synopsis of the modules that comprise the framework. Each module implements a part of the frameworks for a specific encapsulated purpose. The scope of the JSONx Framework for Java is specific for Java. For instance, the binding module provides strongly-typed class binding to leverage the power of Java's compile time in order to reduce the space for potential errors when parsing/marshaling JSON. Something like this does not make sense for JavaScript, because JavaScript does not have a compile time, and does not have strongly-typed classes. Work is just starting to port the JSONx validation functionality to JavaScript in the JSONx Framework for JavaScript repo.

adligo commented 5 years ago

Hi Again Seva,

I think just the binding and generator (generate source in addition to classes directly). In a nutshell I would like the project to do any of the following;

Generate Java Source or Classes for JSON or XML serialization (or de-serialization) with optional Marshaling.

The Java Source MAY optionally include the GWT JSNI comments;

http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html

This would allow all of these to be generated;

1) JSE Java Wherever

2) Client Side Java compiled into GWT applications

3) Client Side JavaScript

4) Server Side JavaScript for Node.js

Notes;

3 & 4 would be generated from the optional JSNI comment code;

The project currently only supports JSE Java Wherever. This would allow synchronization of Marshaling and De-Marshalling code from a single source (Java source code) reducing errors from clients, and errors from translating the project by hand into JavaScript.

On Fri, Jul 26, 2019 at 3:28 PM Seva Safris notifications@github.com wrote:

Hi @adligo https://github.com/adligo, what facet of the JSONx Framework for Java are you referring to with regard to GWT support? The top of the README.md https://github.com/jsonx-org/java#jsonx-framework-for-java gives a synopsis of the modules that comprise the framework. Each module implements a part of the frameworks for a specific encapsulated purpose. The scope of the JSONx Framework for Java is specific for Java. For instance, the binding https://github.com/jsonx-org/java/tree/master/binding module provides strongly-typed class binding to leverage the power of Java's compile time in order to reduce the space for potential errors when parsing/marshaling JSON. Something like this does not make sense for JavaScript, because JavaScript does not have a compile time, and does not have strongly-typed classes. Work is just starting to port the JSONx validation functionality to JavaScript in the JSONx Framework for JavaScript https://github.com/jsonx-org/javascript#jsonx-framework-for-javascript repo.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jsonx-org/java/issues/4?email_source=notifications&email_token=ABSJQCKMS6N6IEWV67RLUKTQBNM7NA5CNFSM4IG6MA62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD25UIGA#issuecomment-515589144, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSJQCI43QZB3XYWZR46VTLQBNM7NANCNFSM4IG6MA6Q .

-- Regards, Scott Morgan President & CEO Adligo Inc http://www.adligo.com https://www.linkedin.com/in/scott-morgan-21739415 A+ Better Business Bureau Rating https://www.bbb.org/chicago/business-reviews/computer-software-publishers-and-developers/adligo-inc-in-chicago-il-88381256 https://github.com/adligo

By Appointment Only: 1-866-968-1893 Ex 101 scott@adligo.com skype:adligo1?call Send Me Files Securely: https://www.sendthisfile.com/f.jsp?id=ewOnyeFQM18IDRf7MMIdolfI https://www.sendthisfile.com/f.jsp?id=ewOnyeFQM18IDRf7MMIdolfI

safris commented 5 years ago

Hi @adligo,

These are interesting ideas. I am not sure, however, how a class generator for JavaScript would be useful, since JSON is a native object format for JavaScript already. It seems that you are specifically looking for GWT integration -- i.e. for JSONx to integrate its strongly-typed class binding capabilities into the Java side of the GWT application, and for that to automatically map to the JavaScript side of the GWT application. Such a solution is directly coupled to GWT, which is why I do not believe it belongs to either JSONx Schema or JSONx Framework for Java. Nonetheless, don't let this dissuade you. The implementation of JSONx is very well encapsulated, which would allow you to simply implement the GWT layer on top of the JSONx Framework for Java libraries. There would definitely need to be a clear separation between JSONx Framework for Java, and JSONx for GWT. To implement such a JSONx for GWT project, I foresee some generator APIs and binding APIs in the framework would need to be expanded. I would be happy to help you with this.

adligo commented 5 years ago

It JSONx wouldn't be just a class generator it would also be a source generator. GWT integration is part of the goal, but use of GWT as a tool to automatically translate the marshaling code to Node.js (just like Java server). The idea is to unify the JSONx project for everything using Java source, instead of separation.

On Fri, Jul 26, 2019 at 6:00 PM Seva Safris notifications@github.com wrote:

Hi @adligo https://github.com/adligo,

These are interesting ideas. I am not sure, however, how a class generator for JavaScript would be useful, since JSON is a native object format for JavaScript already. It seems that you are specifically looking for GWT integration -- i.e. for JSONx to integrate its strongly-typed class binding capabilities into the Java side of the GWT application, and for that to automatically map to the JavaScript side of the GWT application. Such a solution is directly coupled to GWT, which is why I do not believe it belongs to either JSONx Schema https://github.com/jsonx-org/schema or JSONx Framework for Java https://github.com/jsonx-org/java. Nonetheless, don't let this dissuade you. The implementation of JSONx is very well encapsulated, which would allow you to simply implement the GWT layer on top of the JSONx Framework for Java https://github.com/jsonx-org/java libraries. There would definitely need to be a clear separation between JSONx Framework for Java https://github.com/jsonx-org/java, and JSONx for GWT. To implement such a JSONx for GWT project, I foresee some generator APIs https://github.com/jsonx-org/java/tree/master/generator and binding APIs https://github.com/jsonx-org/java/tree/master/binding in the framework would need to be expanded. I would be happy to help you with this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jsonx-org/java/issues/4?email_source=notifications&email_token=ABSJQCNW2VF5UKRKQVBW2UDQBN6XHA5CNFSM4IG6MA62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD254UNA#issuecomment-515623476, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSJQCLWUVHOJFCWQVKKDE3QBN6XHANCNFSM4IG6MA6Q .

-- Regards, Scott Morgan President & CEO Adligo Inc http://www.adligo.com https://www.linkedin.com/in/scott-morgan-21739415 A+ Better Business Bureau Rating https://www.bbb.org/chicago/business-reviews/computer-software-publishers-and-developers/adligo-inc-in-chicago-il-88381256 https://github.com/adligo

By Appointment Only: 1-866-968-1893 Ex 101 scott@adligo.com skype:adligo1?call Send Me Files Securely: https://www.sendthisfile.com/f.jsp?id=ewOnyeFQM18IDRf7MMIdolfI https://www.sendthisfile.com/f.jsp?id=ewOnyeFQM18IDRf7MMIdolfI