Re: gwt-inerop-utils preview

2016-06-03 Thread Hristo Stoyanov
Paul,
I am also hesitating a bit too ... I see some people that I respect do go 
for the whole enchilada 

 with 
no regrets. Here is a JS AP I 
that requires 4-argument callback. 
Jen does have a point  about custom defined functional interfaces, they:
- can have more specific argument types, can even be primitive ones (int, 
boolean, etc...)
- can be documented much better

On Friday, June 3, 2016 at 11:32:24 AM UTC-7, Paul Stockley wrote:
>
> Jens,
> I can see your point, about the usability when you get many arguments. 
> Originally I was going to kind of mirror the Java JDK and not go more than 
> 2. Personally, I think it is a lot better to define custom interfaces when 
> possible. To avoid having hundreds of class files I have started making 
> them local to the API classes. I think this helps with readability.  
>
> The case when the generic functions are useful is when you are prototyping 
> a new API or porting some exsting javascript code. Hristo, what is an 
> actual case where you need 4 or 5 parameters? 
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: gwt-inerop-utils preview

2016-06-03 Thread Paul Stockley
Jens,
I can see your point, about the usability when you get many arguments. 
Originally I was going to kind of mirror the Java JDK and not go more than 
2. Personally, I think it is a lot better to define custom interfaces when 
possible. To avoid having hundreds of class files I have started making 
them local to the API classes. I think this helps with readability.  

The case when the generic functions are useful is when you are prototyping 
a new API or porting some exsting javascript code. Hristo, what is an 
actual case where you need 4 or 5 parameters? 

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: gwt-inerop-utils preview

2016-06-03 Thread Paul Stockley
Jens,

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: gwt-inerop-utils preview

2016-06-02 Thread Jens

>
> If adding a couple of more interfaces is code smell, take a look  at this 
> 
>  ...
>

Yeah I know...
 

> Also, take a look at JS APIs like this 
>  - are we all supposed to 
> define the same 4/5-argument functions for every js library that requires 
> them?
>

IMHO yes, because you can then document the arguments better. Otherwise you 
would need to document the parameters of a parameter function, which is 
pretty annoying, e.g.

/**
 * @param fund Will be called when ... and 
 */
void test(Func5 func);



vs.



/**
 * @param func will be called when ...
 */
void test(TestFunction func)


interface TestFunction {
  /**
   * @param name 
   * @param street 
   * ...
   */
  call(String name, String street, String ..., Integer ..., int )
}



-- J.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: gwt-inerop-utils preview

2016-06-02 Thread Hristo Stoyanov
Thanks Paul,
Let me use the github issues forgiving you  feedback, this forum is not the 
best way.
On Thursday, June 2, 2016 at 2:17:10 PM UTC-7, Paul Stockley wrote:
>
> I will add 4 and 5 arg interfaces. I think I can include something 
> equivalent with your above code. I already have getters/setters and is 
> defined functions for objects. All you would need to do is pass $wnd into 
> these. Let me have a play around and see what I can come up with.
>
> On Thursday, June 2, 2016 at 4:50:08 PM UTC-4, Hristo Stoyanov wrote:
>>
>> Thanks Paul,
>> I was about to start releasing similar code 
>> 
>> . 
>> It does not make sense to do the same thing twice and obviously such 
>> utility code is necessary. So, I will use your project as it seems a bit 
>> more advanced and start contributing!
>>
>> Quick request before I adopt it in my libraries today:
>> - Can you add functional interfaces with 4 and 5 arguments. I think you 
>> have them up to 3 only, but I do face JS libraries with 4 and 5.
>> - Do you have similar utils as the one below? If not, would it be 
>> possible to incorporate something like it in your projects?
>>
>> /**
>>  * JavaScript global variables and functions utils.
>>  *
>>  */
>> //@JsType(isNative = true, namespace = JsPackage.GLOBAL)
>> public abstract class VariablesAndFunctions {
>>
>> public native static  T eval(String expresion);
>>
>> //@JsOverlay
>> //public boolean isJSVariableDefined(String jsVariableName) {
>> //return Boolean.TRUE.equals(eval("!!window[" + jsVariableName + 
>> "]"));
>> //}
>> //
>> //@JsOverlay
>> //public static  T getJSVariableValue(String jsVariableName) {
>> //return eval("!!window[" + jsVariableName + "]");
>> //}
>> public static native String getStringJSVariable(String jsVar) /*-{
>> return $wnd[jsVar].toString();
>> }-*/;
>>
>> public static native Object getJSVariable(String jsVar) /*-{
>> return $wnd[jsVar];
>> }-*/;
>> 
>> public static native boolean isVariableDefined(String jsVar)/*-{
>> return !!$wnd[jsVar];
>> }-*/;
>>
>> public static native boolean isFunctionDefined(String 
>> functionName)/*-{
>> return typeof functionName == 'function';
>> }-*/;
>> }
>>
>>
>>
>> On Thursday, June 2, 2016 at 11:57:46 AM UTC-7, Paul Stockley wrote:
>>>
>>> I have committed an initial version of gwt-interop-utils. 
>>>
>>> https://github.com/GWTReact/gwt-interop-utils
>>>
>>> This library provides some common utilities for working with JsInterop 
>>> e.g.
>>>
>>> 1) Object Literal support
>>> 2) Shared JSON compatible structures
>>> 3) Common functional interfaces
>>> 4) JSON utilities
>>> 5) Low level Javascript utilities.
>>>
>>> One of my major goals was to enable creating complex object literals 
>>> with arrays and maps that could be represented by a single class, 
>>> accessible both on the client and server. You can now define a class such as
>>>
>>> import gwt.interop.utils.shared.collections.Array;
>>> import gwt.interop.utils.shared.collections.StringMap;
>>> import gwt.interop.utils.shared.valuetypes.NumberValue;
>>>
>>> @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
>>> public class CommonDataObject {
>>> public int intVal;
>>> public double doubleVal;
>>> public boolean booleanVal;
>>> public String stringVal;
>>> public NumberValue numberVal;
>>> public Array anArray;
>>> public StringMap aMap;
>>> public CommonDataObject2 embeddedObj;
>>>
>>> @JsOverlay
>>> public static CommonDataObject create() {
>>> CommonDataObject o = new CommonDataObject();
>>> o.intVal = 10;
>>> o.doubleVal = 20.20;
>>> o.booleanVal = true;
>>> o.stringVal = "A String Value";
>>> o.numberVal = NumberValue.from(10);
>>> o.anArray = Array.create();
>>>
>>> o.anArray.set(0, "ArrayValue1");
>>> o.anArray.set(2, "ArrayValue2");
>>> o.anArray.set(2, "ArrayValue3");
>>>
>>> o.aMap = StringMap.create();
>>>
>>> o.aMap.put("v1", "A Map Value 1");
>>> o.aMap.put("v2", "A Map Value 2");
>>>
>>> o.embeddedObj = new CommonDataObject2();
>>> o.embeddedObj.field1 = "An embbeded object field";
>>> return o;
>>> }
>>>
>>> @JsOverlay
>>> public final String convolutedSharedMethod(String someArg) {
>>> StringBuilder o = new StringBuilder();
>>>
>>> anArray.forEachElem((e) -> {
>>> o.append(aMap.get(someArg));
>>> o.append(embeddedObj.field1);
>>> o.append(e);
>>> });
>>>
>>> return o.toString();
>>> }
>>> }
>>>
>>> @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
>>> public class CommonDataObject2 {
>>> public String field1;
>>> }
>>>
>>> Instances of this class can be encoded to/from JSON using standard JSON 
>>> functions. You can also create/use the same class on the server and full 
>>> emulation is provided. Given this setup, it gives you a lot of the benefits 
>>> of GWT RPC (i.e. shared data objects and behavi

Re: gwt-inerop-utils preview

2016-06-02 Thread Hristo Stoyanov
Jen,
If adding a couple of more interfaces is code smell, take a look  at this 

 ...
Also, take a look at JS APIs like this 
 - are we all supposed to define 
the same 4/5-argument functions for every js library that requires them?

On Thursday, June 2, 2016 at 3:10:44 PM UTC-7, Jens wrote:
>
>
> I will add 4 and 5 arg interfaces.
>>
>
> I can already smell the code smell..
>
> void myAsyncFunction(Func5 
> onSuccess, Func5 onFailure);
>
> IMHO its fine to just have Func1 and for anything else chose a concrete 
> name for a concrete functional interface so you have a place to document 
> all these parameters. The above should be myAsyncFunction(OnSuccessCallback 
> ..., OnFailureCallback ...) with some nice JavaDoc in OnSuccessCallback, 
> OnFailureCallback.
>
> So think twice if its really a good idea to add any kind of possibly 
> "useful" interfaces.
>
> -- J.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: gwt-inerop-utils preview

2016-06-02 Thread Jens


> I will add 4 and 5 arg interfaces.
>

I can already smell the code smell..

void myAsyncFunction(Func5 
onSuccess, Func5 onFailure);

IMHO its fine to just have Func1 and for anything else chose a concrete 
name for a concrete functional interface so you have a place to document 
all these parameters. The above should be myAsyncFunction(OnSuccessCallback 
..., OnFailureCallback ...) with some nice JavaDoc in OnSuccessCallback, 
OnFailureCallback.

So think twice if its really a good idea to add any kind of possibly 
"useful" interfaces.

-- J.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: gwt-inerop-utils preview

2016-06-02 Thread Paul Stockley
I will take a look at the putnami-gradle-plugin. I noticed Steffan's didn't 
seem to be supported. Thanks for the offer on migration. The projects are a 
bit in flux at the moment so probably better off not submitting a pull 
request until I have landed all the gwt-interop-utils changes.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: gwt-inerop-utils preview

2016-06-02 Thread Paul Stockley
I will add 4 and 5 arg interfaces. I think I can include something 
equivalent with your above code. I already have getters/setters and is 
defined functions for objects. All you would need to do is pass $wnd into 
these. Let me have a play around and see what I can come up with.

On Thursday, June 2, 2016 at 4:50:08 PM UTC-4, Hristo Stoyanov wrote:
>
> Thanks Paul,
> I was about to start releasing similar code 
> 
> . 
> It does not make sense to do the same thing twice and obviously such 
> utility code is necessary. So, I will use your project as it seems a bit 
> more advanced and start contributing!
>
> Quick request before I adopt it in my libraries today:
> - Can you add functional interfaces with 4 and 5 arguments. I think you 
> have them up to 3 only, but I do face JS libraries with 4 and 5.
> - Do you have similar utils as the one below? If not, would it be possible 
> to incorporate something like it in your projects?
>
> /**
>  * JavaScript global variables and functions utils.
>  *
>  */
> //@JsType(isNative = true, namespace = JsPackage.GLOBAL)
> public abstract class VariablesAndFunctions {
>
> public native static  T eval(String expresion);
>
> //@JsOverlay
> //public boolean isJSVariableDefined(String jsVariableName) {
> //return Boolean.TRUE.equals(eval("!!window[" + jsVariableName + 
> "]"));
> //}
> //
> //@JsOverlay
> //public static  T getJSVariableValue(String jsVariableName) {
> //return eval("!!window[" + jsVariableName + "]");
> //}
> public static native String getStringJSVariable(String jsVar) /*-{
> return $wnd[jsVar].toString();
> }-*/;
>
> public static native Object getJSVariable(String jsVar) /*-{
> return $wnd[jsVar];
> }-*/;
> 
> public static native boolean isVariableDefined(String jsVar)/*-{
> return !!$wnd[jsVar];
> }-*/;
>
> public static native boolean isFunctionDefined(String functionName)/*-{
> return typeof functionName == 'function';
> }-*/;
> }
>
>
>
> On Thursday, June 2, 2016 at 11:57:46 AM UTC-7, Paul Stockley wrote:
>>
>> I have committed an initial version of gwt-interop-utils. 
>>
>> https://github.com/GWTReact/gwt-interop-utils
>>
>> This library provides some common utilities for working with JsInterop 
>> e.g.
>>
>> 1) Object Literal support
>> 2) Shared JSON compatible structures
>> 3) Common functional interfaces
>> 4) JSON utilities
>> 5) Low level Javascript utilities.
>>
>> One of my major goals was to enable creating complex object literals with 
>> arrays and maps that could be represented by a single class, accessible 
>> both on the client and server. You can now define a class such as
>>
>> import gwt.interop.utils.shared.collections.Array;
>> import gwt.interop.utils.shared.collections.StringMap;
>> import gwt.interop.utils.shared.valuetypes.NumberValue;
>>
>> @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
>> public class CommonDataObject {
>> public int intVal;
>> public double doubleVal;
>> public boolean booleanVal;
>> public String stringVal;
>> public NumberValue numberVal;
>> public Array anArray;
>> public StringMap aMap;
>> public CommonDataObject2 embeddedObj;
>>
>> @JsOverlay
>> public static CommonDataObject create() {
>> CommonDataObject o = new CommonDataObject();
>> o.intVal = 10;
>> o.doubleVal = 20.20;
>> o.booleanVal = true;
>> o.stringVal = "A String Value";
>> o.numberVal = NumberValue.from(10);
>> o.anArray = Array.create();
>>
>> o.anArray.set(0, "ArrayValue1");
>> o.anArray.set(2, "ArrayValue2");
>> o.anArray.set(2, "ArrayValue3");
>>
>> o.aMap = StringMap.create();
>>
>> o.aMap.put("v1", "A Map Value 1");
>> o.aMap.put("v2", "A Map Value 2");
>>
>> o.embeddedObj = new CommonDataObject2();
>> o.embeddedObj.field1 = "An embbeded object field";
>> return o;
>> }
>>
>> @JsOverlay
>> public final String convolutedSharedMethod(String someArg) {
>> StringBuilder o = new StringBuilder();
>>
>> anArray.forEachElem((e) -> {
>> o.append(aMap.get(someArg));
>> o.append(embeddedObj.field1);
>> o.append(e);
>> });
>>
>> return o.toString();
>> }
>> }
>>
>> @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
>> public class CommonDataObject2 {
>> public String field1;
>> }
>>
>> Instances of this class can be encoded to/from JSON using standard JSON 
>> functions. You can also create/use the same class on the server and full 
>> emulation is provided. Given this setup, it gives you a lot of the benefits 
>> of GWT RPC (i.e. shared data objects and behavior across client/server) 
>> without the code bloat or performance hit.
>>
>> Before I publish it to Maven, I still need to finish the docs and do some 
>> more testing. I am also waiting for some compiler fixes to land.
>>
>> Please take a look and let me know if there are any changes/additions you 
>> would like.
>

Re: gwt-inerop-utils preview

2016-06-02 Thread Hristo Stoyanov
... also, I noticed you are using the Steffan's GWT Gradle plugin. I did 
encounter subtle issues with it lately (see gihub issue threads) and 
realized it is no longer supported. I highly recommend switching to this one 
. It is simpler, provides 
similar functionality, the switch to it was painless,* but most 
importantly, the author, Fabien Dumay, is very responsive!* I could 
re-write you gradle scripts in a pull request, if that is ok?

On Thursday, June 2, 2016 at 1:50:08 PM UTC-7, Hristo Stoyanov wrote:
>
> Thanks Paul,
> I was about to start releasing similar code 
> 
> . 
> It does not make sense to do the same thing twice and obviously such 
> utility code is necessary. So, I will use your project as it seems a bit 
> more advanced and start contributing!
>
> Quick request before I adopt it in my libraries today:
> - Can you add functional interfaces with 4 and 5 arguments. I think you 
> have them up to 3 only, but I do face JS libraries with 4 and 5.
> - Do you have similar utils as the one below? If not, would it be possible 
> to incorporate something like it in your projects?
>
> /**
>  * JavaScript global variables and functions utils.
>  *
>  */
> //@JsType(isNative = true, namespace = JsPackage.GLOBAL)
> public abstract class VariablesAndFunctions {
>
> public native static  T eval(String expresion);
>
> //@JsOverlay
> //public boolean isJSVariableDefined(String jsVariableName) {
> //return Boolean.TRUE.equals(eval("!!window[" + jsVariableName + 
> "]"));
> //}
> //
> //@JsOverlay
> //public static  T getJSVariableValue(String jsVariableName) {
> //return eval("!!window[" + jsVariableName + "]");
> //}
> public static native String getStringJSVariable(String jsVar) /*-{
> return $wnd[jsVar].toString();
> }-*/;
>
> public static native Object getJSVariable(String jsVar) /*-{
> return $wnd[jsVar];
> }-*/;
> 
> public static native boolean isVariableDefined(String jsVar)/*-{
> return !!$wnd[jsVar];
> }-*/;
>
> public static native boolean isFunctionDefined(String functionName)/*-{
> return typeof functionName == 'function';
> }-*/;
> }
>
>
>
> On Thursday, June 2, 2016 at 11:57:46 AM UTC-7, Paul Stockley wrote:
>>
>> I have committed an initial version of gwt-interop-utils. 
>>
>> https://github.com/GWTReact/gwt-interop-utils
>>
>> This library provides some common utilities for working with JsInterop 
>> e.g.
>>
>> 1) Object Literal support
>> 2) Shared JSON compatible structures
>> 3) Common functional interfaces
>> 4) JSON utilities
>> 5) Low level Javascript utilities.
>>
>> One of my major goals was to enable creating complex object literals with 
>> arrays and maps that could be represented by a single class, accessible 
>> both on the client and server. You can now define a class such as
>>
>> import gwt.interop.utils.shared.collections.Array;
>> import gwt.interop.utils.shared.collections.StringMap;
>> import gwt.interop.utils.shared.valuetypes.NumberValue;
>>
>> @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
>> public class CommonDataObject {
>> public int intVal;
>> public double doubleVal;
>> public boolean booleanVal;
>> public String stringVal;
>> public NumberValue numberVal;
>> public Array anArray;
>> public StringMap aMap;
>> public CommonDataObject2 embeddedObj;
>>
>> @JsOverlay
>> public static CommonDataObject create() {
>> CommonDataObject o = new CommonDataObject();
>> o.intVal = 10;
>> o.doubleVal = 20.20;
>> o.booleanVal = true;
>> o.stringVal = "A String Value";
>> o.numberVal = NumberValue.from(10);
>> o.anArray = Array.create();
>>
>> o.anArray.set(0, "ArrayValue1");
>> o.anArray.set(2, "ArrayValue2");
>> o.anArray.set(2, "ArrayValue3");
>>
>> o.aMap = StringMap.create();
>>
>> o.aMap.put("v1", "A Map Value 1");
>> o.aMap.put("v2", "A Map Value 2");
>>
>> o.embeddedObj = new CommonDataObject2();
>> o.embeddedObj.field1 = "An embbeded object field";
>> return o;
>> }
>>
>> @JsOverlay
>> public final String convolutedSharedMethod(String someArg) {
>> StringBuilder o = new StringBuilder();
>>
>> anArray.forEachElem((e) -> {
>> o.append(aMap.get(someArg));
>> o.append(embeddedObj.field1);
>> o.append(e);
>> });
>>
>> return o.toString();
>> }
>> }
>>
>> @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
>> public class CommonDataObject2 {
>> public String field1;
>> }
>>
>> Instances of this class can be encoded to/from JSON using standard JSON 
>> functions. You can also create/use the same class on the server and full 
>> emulation is provided. Given this setup, it gives you a lot of the benefits 
>> of GWT RPC (i.e. shared data objects and behavior across client/server) 
>> without the code bloat or performance hit.
>>
>> Before I publish it to Mave

Re: gwt-inerop-utils preview

2016-06-02 Thread Hristo Stoyanov
Thanks Paul,
I was about to start releasing similar code 

. 
It does not make sense to do the same thing twice and obviously such 
utility code is necessary. So, I will use your project as it seems a bit 
more advanced and start contributing!

Quick request before I adopt it in my libraries today:
- Can you add functional interfaces with 4 and 5 arguments. I think you 
have them up to 3 only, but I do face JS libraries with 4 and 5.
- Do you have similar utils as the one below? If not, would it be possible 
to incorporate something like it in your projects?

/**
 * JavaScript global variables and functions utils.
 *
 */
//@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public abstract class VariablesAndFunctions {

public native static  T eval(String expresion);

//@JsOverlay
//public boolean isJSVariableDefined(String jsVariableName) {
//return Boolean.TRUE.equals(eval("!!window[" + jsVariableName + 
"]"));
//}
//
//@JsOverlay
//public static  T getJSVariableValue(String jsVariableName) {
//return eval("!!window[" + jsVariableName + "]");
//}
public static native String getStringJSVariable(String jsVar) /*-{
return $wnd[jsVar].toString();
}-*/;

public static native Object getJSVariable(String jsVar) /*-{
return $wnd[jsVar];
}-*/;

public static native boolean isVariableDefined(String jsVar)/*-{
return !!$wnd[jsVar];
}-*/;

public static native boolean isFunctionDefined(String functionName)/*-{
return typeof functionName == 'function';
}-*/;
}



On Thursday, June 2, 2016 at 11:57:46 AM UTC-7, Paul Stockley wrote:
>
> I have committed an initial version of gwt-interop-utils. 
>
> https://github.com/GWTReact/gwt-interop-utils
>
> This library provides some common utilities for working with JsInterop e.g.
>
> 1) Object Literal support
> 2) Shared JSON compatible structures
> 3) Common functional interfaces
> 4) JSON utilities
> 5) Low level Javascript utilities.
>
> One of my major goals was to enable creating complex object literals with 
> arrays and maps that could be represented by a single class, accessible 
> both on the client and server. You can now define a class such as
>
> import gwt.interop.utils.shared.collections.Array;
> import gwt.interop.utils.shared.collections.StringMap;
> import gwt.interop.utils.shared.valuetypes.NumberValue;
>
> @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
> public class CommonDataObject {
> public int intVal;
> public double doubleVal;
> public boolean booleanVal;
> public String stringVal;
> public NumberValue numberVal;
> public Array anArray;
> public StringMap aMap;
> public CommonDataObject2 embeddedObj;
>
> @JsOverlay
> public static CommonDataObject create() {
> CommonDataObject o = new CommonDataObject();
> o.intVal = 10;
> o.doubleVal = 20.20;
> o.booleanVal = true;
> o.stringVal = "A String Value";
> o.numberVal = NumberValue.from(10);
> o.anArray = Array.create();
>
> o.anArray.set(0, "ArrayValue1");
> o.anArray.set(2, "ArrayValue2");
> o.anArray.set(2, "ArrayValue3");
>
> o.aMap = StringMap.create();
>
> o.aMap.put("v1", "A Map Value 1");
> o.aMap.put("v2", "A Map Value 2");
>
> o.embeddedObj = new CommonDataObject2();
> o.embeddedObj.field1 = "An embbeded object field";
> return o;
> }
>
> @JsOverlay
> public final String convolutedSharedMethod(String someArg) {
> StringBuilder o = new StringBuilder();
>
> anArray.forEachElem((e) -> {
> o.append(aMap.get(someArg));
> o.append(embeddedObj.field1);
> o.append(e);
> });
>
> return o.toString();
> }
> }
>
> @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
> public class CommonDataObject2 {
> public String field1;
> }
>
> Instances of this class can be encoded to/from JSON using standard JSON 
> functions. You can also create/use the same class on the server and full 
> emulation is provided. Given this setup, it gives you a lot of the benefits 
> of GWT RPC (i.e. shared data objects and behavior across client/server) 
> without the code bloat or performance hit.
>
> Before I publish it to Maven, I still need to finish the docs and do some 
> more testing. I am also waiting for some compiler fixes to land.
>
> Please take a look and let me know if there are any changes/additions you 
> would like.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.