Re: Problem decoding complex AutoBean
I'm not seeing any issue with that code and sample JSON. Here's a quick entrypoint that I made: @Override public void onModuleLoad() { IWebchatThemeConfigurationBean bean = deserializeFromJson("{\n" + "\"themeId\": 1,\n" + "\"name\": \"rpc\",\n" + "\"enabled\": true,\n" + "\"propertiesList\": [\n" + "{\n" + "\"id\": 1,\n" + "\"themeConfigurationId\": 1,\n" + "\"chatScreen\": \"chatScreen\",\n" + "\"component\": \"header\",\n" + "\"property\": \"text\",\n" + "\"value\": \"HELLO\"\n" + "},\n" + "{\n" + "\"id\": 3,\n" + "\"themeConfigurationId\": 1,\n" + "\"chatScreen\": \"chatScreen\",\n" + "\"component\": \"background\",\n" + "\"property\": \"color\",\n" + "\"value\": \"rgba(0,191,255,0.5)\"\n" + "}\n" + "]\n" + "}"); DomGlobal.console.log(bean.getEnabled()); DomGlobal.console.log(bean.getThemeId() + ""); DomGlobal.console.log(bean.getName()); DomGlobal.console.log(String.valueOf(bean.getPropertiesList())); DomGlobal.console.log(bean.getPropertiesList().size() + ""); DomGlobal.console.log(bean.getPropertiesList().stream().map(IWebchatThemeConfigurationPropertyBean::getValue).collect(Collectors.joining(", "))); } Notice that after running your parse method, it dumps the output to the JS console - here is the output: true 1 rpc [com.vertispan.draw.connected.client.FlowChartEntryPoint_IWebchatThemeConfigurationPropertyBeanAutoBean$2@1b, com.vertispan.draw.connected.client.FlowChartEntryPoint_IWebchatThemeConfigurationPropertyBeanAutoBean$2@1c] 2 HELLO, rgba(0,191,255,0.5) It seems to be working? One note: if you do not actually call the properties() method, it is not needed in the factory, since the IWebchatThemeConfigurationPropertyBean type is already reachable from IWebchatThemeConfigurationBean. Using GWT 2.8.2 for this test. On Friday, July 10, 2020 at 3:23:35 PM UTC-5, Akshay Kumar wrote: > > Can anyone help me? > My json string is - > { > "themeId": 1, > "name": "rpc", > "enabled": true, > "propertiesList": [ > { > "id": 1, > "themeConfigurationId": 1, > "chatScreen": "chatScreen", > "component": "header", > "property": "text", > "value": "HELLO" > }, > { > "id": 3, > "themeConfigurationId": 1, > "chatScreen": "chatScreen", > "component": "background", > "property": "color", > "value": "rgba(0,191,255,0.5)" > } > ] > } > > Interfaces are - > > public interface IWebchatThemeConfigurationBean { public Integer > getThemeId(); public String getName(); public Boolean getEnabled(); public > List getPropertiesList(); } > public interface IWebchatThemeConfigurationPropertyBean { public Integer > getId(); public Integer getThemeConfigurationId(); public String > getChatScreen(); public String getComponent(); public String getProperty(); > public String getValue(); } > > public interface ChatFactory extends AutoBeanFactory { > AutoBean theme(); > > AutoBean properties(); > } > ChatFactory factory; > factory = GWT.create(ChatFactory.class); > > IWebchatThemeConfigurationBean deserializeFromJson(String json) { > AutoBean bean = > AutoBeanCodex.decode(factory, IWebchatThemeConfigurationBean.class, json); > return bean.as(); } > > in this returned bean I'm getting null propertiesList. > name, enabled, themeId are fine. > > On Tuesday, August 20, 2013 at 8:07:30 AM UTC+5:30, Thad Humphries wrote: >> >> I've managed a simple AutoBean with a list. Now I've a more complex one, >> and I don't understand what's wrong. My get methods are r
Re: Problem decoding complex AutoBean
Can anyone help me? My json string is - { "themeId": 1, "name": "rpc", "enabled": true, "propertiesList": [ { "id": 1, "themeConfigurationId": 1, "chatScreen": "chatScreen", "component": "header", "property": "text", "value": "HELLO" }, { "id": 3, "themeConfigurationId": 1, "chatScreen": "chatScreen", "component": "background", "property": "color", "value": "rgba(0,191,255,0.5)" } ] } Interfaces are - public interface IWebchatThemeConfigurationBean { public Integer getThemeId(); public String getName(); public Boolean getEnabled(); public List getPropertiesList(); } public interface IWebchatThemeConfigurationPropertyBean { public Integer getId(); public Integer getThemeConfigurationId(); public String getChatScreen(); public String getComponent(); public String getProperty(); public String getValue(); } public interface ChatFactory extends AutoBeanFactory { AutoBean theme(); AutoBean properties(); } ChatFactory factory; factory = GWT.create(ChatFactory.class); IWebchatThemeConfigurationBean deserializeFromJson(String json) { AutoBean bean = AutoBeanCodex.decode(factory, IWebchatThemeConfigurationBean.class, json); return bean.as(); } in this returned bean I'm getting null propertiesList. name, enabled, themeId are fine. On Tuesday, August 20, 2013 at 8:07:30 AM UTC+5:30, Thad Humphries wrote: > > I've managed a simple AutoBean with a list. Now I've a more complex one, > and I don't understand what's wrong. My get methods are returning null > though the debugger shows the object has data. > > The JSON looks like this: > > { > "mquery": > { > "screenname":"Index Card", > "fields": > { > "field":[ > {"title":"Name", "name":"odname", "value":"*TIFF*"}, > {"title":"Date", "name":"oddate", "value":""}, > {"title":"Ref #", "name":"odrefnum", "value":""} > ] > } > } > } > > > I have three interfaces: > > public interface Field { > String getTitle(); > void setTitle(String title); > String getName(); > void setName(String name); > String getValue(); > void setValue(String value); > } > > public interface FieldList { > List getField(); > void setField(List field); > } > > public interface MQuery { > String getScreenname(); > void setScreenname(String screenname); > FieldList getFields(); > void setFields(FieldList fields); > } > > In my bean factory, I have > > public interface BeanFactory extends AutoBeanFactory { > ... > AutoBean field(); > AutoBean fields(); > AutoBean mquery(); > } > > In my onResponseReceived() method, I call > > AutoBean mqueryBean = > AutoBeanCodex.decode(clientFactory.getBeanFactory(), > MQuery.class, response.getText()); > MQuery mQuery = mqueryBean.as(); > logger.log(Level.INFO, mQuery.getScreenname()); > screenName = mQuery.getScreenname(); > fieldList = mQuery.getFields().getField(); > view.renderFields(fieldList); > > When I look at the debugger in Chrome, screenname, etc are populated (in > mQuery:this$0:data_0 there is mquery with screenename set and 3 field > objects in fields). However mQuery.getScreenname() returns null as does > mQuery.getFields(). > > What am I not seeing here? Could the presence of other AutoBean<>s in my > factory (beans that work) be messing me up (do I need a separate factory)? > > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/9aaf50f4-7464-4498-8632-701e4fd217f5o%40googlegroups.com.
Re: AutoBean sample not working for me?
Thanks all that worked - one other thing, I wanted to do the serialization without interfaces, found this project gwt-jackson which works, just wanted to post it in case it helps others: https://github.com/nmorel/gwt-jackson > ] >> >> > -- 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: AutoBean sample not working for me?
To clarify, you need to add something like makeAddress to DoSomething: Address makeAddress() { // Construct the AutoBean AutoBean address = factory.address(); // Return the Address interface shim return address.as(); } Then you can change your code to: DoSomething test = new DoSomething(); Person person = test.makePerson(); person.setName("me"); person.setAddress(test.makeAddress()); String json = test.serializeToJson(person); On Fri, Jun 17, 2016 at 4:13 PM, Michael McIntosh <mike.g.mcint...@gmail.com > wrote: > You need to create the person by calling makePerson. > > Sent from my iPhone > > On Jun 17, 2016, at 3:35 PM, sdfdsf dsfsdfds <bittransfer2...@gmail.com> > wrote: > > Hi, > > I copy / pasted the AutoBean serialization example from here: > > http://www.gwtproject.org/doc/latest/DevGuideAutoBeans.html > > I've implemented the necessary interfaces etc to setup a quick test which > can be summarized as follows: > > PersonImpl person = new PersonImpl(); > person.setName("me"); > person.setAddress(new AddressImpl(...)); > > DoSomething test = new DoSomething(); > String json = test.serializeToJson(person); > > The value of "json" is null. > > Is this sample working for everyone? I'm using GWT 2.7 with java 1.7. > > Thanks > > -- > 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. > > -- 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: AutoBean sample not working for me?
Either that or add a method to the AutoBeanFactory taking a Person as argument to be wrapped as an AutoBean. (From memory) -- 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: AutoBean sample not working for me?
You need to create the person by calling makePerson. Sent from my iPhone > On Jun 17, 2016, at 3:35 PM, sdfdsf dsfsdfds <bittransfer2...@gmail.com> > wrote: > > Hi, > > I copy / pasted the AutoBean serialization example from here: > > http://www.gwtproject.org/doc/latest/DevGuideAutoBeans.html > > I've implemented the necessary interfaces etc to setup a quick test which can > be summarized as follows: > > PersonImpl person = new PersonImpl(); > person.setName("me"); > person.setAddress(new AddressImpl(...)); > > DoSomething test = new DoSomething(); > String json = test.serializeToJson(person); > > The value of "json" is null. > > Is this sample working for everyone? I'm using GWT 2.7 with java 1.7. > > Thanks > -- > 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. -- 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.
AutoBean sample not working for me?
Hi, I copy / pasted the AutoBean serialization example from here: http://www.gwtproject.org/doc/latest/DevGuideAutoBeans.html I've implemented the necessary interfaces etc to setup a quick test which can be summarized as follows: PersonImpl person = new PersonImpl(); person.setName("me"); person.setAddress(new AddressImpl(...)); DoSomething test = new DoSomething(); String json = test.serializeToJson(person); The value of "json" is null. Is this sample working for everyone? I'm using GWT 2.7 with java 1.7. Thanks -- 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.
[gwt-contrib] AutoBean wrapping on List method return types
In preparation for submitting a patch with Java8 Streams to GWT, I've been using streams in more situations, and have found a case with AutoBeans where they don't behave correctly. Specifically, AutoBeanFactoryGenerator builds a "shim" type for each object that it will interact with, starting with the bean types declared on the factory, and recursively handling each type it encounters as return types from declared methods. ABFGenerator doesn't have any special wiring for List/Map/Set, which surprised me, since there is a specific class to wrap Splittable instances rather than getting an autobean wrapper/shim type - the SplittableList, SplittableSet and SplittableComplex/SimpleMap types serve this purpose - at least I thought it did. Upon reading more deeply, it seems that the generated type emul.java.util.ListAutoBean is used if 1. a wrapped (not-splittable) autobean 2. has a method that returns List, and 3. the returned value from that method/getter is not itself an autobean. In that case, the 'normal' list type gets wrapped, and the shim delegates all of its calls to the non-autobean list. Not what I had thought happened, but hey, great to learn. I had assumed that the generics issue would get in the way of this - no autobean type can actually be generic, since when we turn the JS into actual Java types, we can't just cast at will - the interfaces are not backed by JSOs after all (until you look at Splittable, but that's a different story). The generator will give you nice errors if you attempt to register a generic type *other* than by wrapping an existing type. The first problem I've run into is in adding a method like Java8's Collection.stream() or Collection.spliterator(). For Spliterator, for example, it attempts to generate a type emul.java.util.SpliteratorAutoBean, which means the method getComparator(): public class SpliteratorAutoBean extends com.google.web.bindery.autobean. shared.impl.AbstractAutoBean { private final java.util.Spliterator shim = new java.util.Spliterator() { public java.util.Comparator getComparator() { java.util.Comparator toReturn = SpliteratorAutoBean.this.getWrapped(). getComparator(); if (toReturn != null) { if (SpliteratorAutoBean.this.isWrapped(toReturn)) { toReturn = SpliteratorAutoBean.this.getFromWrapper(toReturn); } else { toReturn = new emul.java.util.ComparatorAutoBean(getFactory(), toReturn).as(); } } return toReturn; } So then a ComparatorAutoBean is generated, and in turn, it must have all of its method emulated. Unfortunately, it gets a few of these wrong (ABFGenerator doesn't think to avoid wrapping static methods): public java.util.Comparator naturalOrder() { java.util.Comparator toReturn = ComparatorAutoBean.this.getWrapped(). naturalOrder(); if (toReturn != null) { if (ComparatorAutoBean.this.isWrapped(toReturn)) { toReturn = ComparatorAutoBean.this.getFromWrapper(toReturn); } else { toReturn = new emul.java.util.ComparatorAutoBean(getFactory(), toReturn).as(); } } ComparatorAutoBean.this.call("naturalOrder", toReturn ); return toReturn; } This is solved easily enough by checking to see if a method is static as we iterate through and build up shims. However, this isn't sufficient to make the SpliteratorAutoBean sane. Quick reminder: methods in autobeans are in four varieties - GET, SET, SET_BUILDER, and CALL. SET_BUILDER is a SET that returns 'this' so you can have a nice builder api, and anything that doesn't look like a getter or a setter is made into a CALL. Here's a funny thing - Splitterator.getComparator() looks like a GET, not a CALL. Spliterator.getExactSizeIfKnown() also is a GET, but on the other hand, Spliterator.hasCharacteristics(int) is a CALL, since it has a parameter. This means that we a) descend and generate a ComparatorAutoBean type as above, but also that the AutoBeanVisitor wiring must be able to also descend into this. This introduces our second problem (in bold): @Override protected void traverseProperties(com.google.web.bindery. autobean.shared.AutoBeanVisitor visitor, com.google.web.bindery.autobean. shared.impl.AbstractAutoBean.OneShotContext ctx) { com.google.web.bindery.autobean.shared.impl.AbstractAutoBean bean; Object value; com.google.web.bindery.autobean.gwt.client.impl.ClientPropertyContext propertyContext; java.util.Spliterator as = as(); bean = (com.google.web.bindery.autobean.shared.impl.AbstractAutoBean) com.google.web.bindery.autobean.shared.AutoBeanUtils.getAutoBean(as. getComparator()); propertyContext = new com.google.web.bindery.autobean.gwt.client.impl. ClientPropertyContext( as, com.google.web.bindery.autobean.gwt.client.impl.ClientPropertyContext. Setter.beanSetter(SpliteratorAutoBean.this, "comp
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
So AutoBeans seem to be working now, however I'm still getting the 'xxx_classlit_xx not defined' exception when I try to use other gwt classes. For instance the following method: public ClerkD setEvents(HasValue?... fields) { for (HasValue? f : fields) { f.addValueChangeHandler( e - validate() ); } return this; } produces: com.google.gwt.core.client.JavaScriptException: (ReferenceError) : Lcom_google_gwt_user_client_ui_HasValue_2_classLit_0_g$ is not defined I'm wondering if this is because of my use of lambdas / sourceLevel 1.8 and if I should've stuck to using 1.7. Jen, in your project, are you using sourceLevel 1.7 or 1.8? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: SDM bug when using AutoBean
When I switch to 2.8.0-SNAPSHOT, then serializing the bean to json works. However, deserializing it from json fails. Updated code: Factory factory = GWT.create(Factory.class); Test test = factory.test().as(); GWT.log(Created bean); MapString, String testMap = new HashMap(); testMap.put(foo, bar); test.setTest(testMap); GWT.log(Set map); String json = AutoBeanCodex.encode( AutoBeanUtils.getAutoBean(test) ).getPayload(); GWT.log(Got json: + json); Test decoded = AutoBeanCodex.decode(factory, Test.class, json).as(); GWT.log(Decoded); Output: Created bean Set map Got json: {test:{foo:bar}} Uncaught ReferenceError: Ljava_util_Collection_2_classLit_0_g$ is not defined FactoryImpl.java:9 initializeCreatorMap_0_g$ AbstractAutoBeanFactory.java:84 maybeInitializeCreatorMap_0_g$ AbstractAutoBeanFactory.java:37 create_59_g$ AutoBeanCodexImpl.java:544 doDecode_0_g $AutoBeanCodex.java:39 decode_2_g$AutoBeanCodex.java:55 decode_3_g$BeanTest.java:34 onModuleLoad_3_g$com_00046test_00046BeanTest__EntryMethodHolder.java:3 init_2_g$ModuleUtils.java:44 initializeModules_0_g$Impl.java:247 apply_0_g$Impl.java:306 entry0_0_g$Impl.java:72 (anonymous function)ModuleUtils.java:55 gwtOnLoad_0_g$Splittable.java:26 (anonymous function) Trying to use a List also gives a similar reference error, this time about Iterator not being defined. This is making it unfeasible to use autobeans.. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
Hi Alberto, Were you running this in SDM mode? I've found that the bug I encounter is in SDM, but in regular / production, it runs without issue. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
SDM bug when using AutoBean
In SDM mode, I can't seem to use AutoBean on beans that have a Map as one of their properties. Example bean + factory: public interface Test extends Serializable { public MapString, String getTest(); public void setTest(MapString, String test); } public interface Factory extends AutoBeanFactory { AutoBeanTest test(); } Usage: Factory factory = GWT.create(Factory.class); Test test = factory.test().as(); GWT.log(Created bean); MapString, String testMap = new HashMap(); testMap.put(foo, bar); test.setTest( testMap ); GWT.log(Set map); String json = AutoBeanCodex.encode( AutoBeanUtils.getAutoBean(test) ).getPayload(); GWT.log(Got json: + json); Output: Created bean Uncaught ReferenceError: Ljava_util_Map_2_classLit_0_g$ is not defined This code works if I compile and run it from production, but in SDM I get the above error. I've created a repo for a sample project where this bug can be replicated: https://github.com/aliakhtar/AutobeanTest Is there a workaround that I can use for now, or do I need to do a full compile each time / use overlay types? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
This issue was fixed when i switched from 2.7.0 to 2.8.0-Snapshot . However, in the snapshot, beans which have only primitives and Strings work. But, beans that have any collections ( lists / maps) don't work, giving a similar error as this. I've posted a stacktrace and made a test project to be cloned to reproduce it, here: https://groups.google.com/forum/#!topic/google-web-toolkit/Uf3IUgeUdP8 -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
This issue was fixed when i switched from 2.7.0 to 2.8.0-Snapshot . However, in the snapshot, beans which have only primitives and Strings work. But, beans that have any collections ( lists / maps) don't work, giving a similar error as this. At work we use SDM with incremental compile, GWT 2.8.0-SNAPSHOT and an AutoBean that contains primitives (boolean, String), a Set as well as a MapString, SetString. We are decoding the JSON on client side without any problems (encoding happens on server). -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
Any ideas what the issue might be then? Do you use intellij for running SDM? And, can you repro the issue if you clone the repo I linked in the other post? On Feb 9, 2015 3:42 AM, Jens jens.nehlme...@gmail.com wrote: This issue was fixed when i switched from 2.7.0 to 2.8.0-Snapshot . However, in the snapshot, beans which have only primitives and Strings work. But, beans that have any collections ( lists / maps) don't work, giving a similar error as this. At work we use SDM with incremental compile, GWT 2.8.0-SNAPSHOT and an AutoBean that contains primitives (boolean, String), a Set as well as a MapString, SetString. We are decoding the JSON on client side without any problems (encoding happens on server). -- J. -- You received this message because you are subscribed to a topic in the Google Groups Google Web Toolkit group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/RzsjqX2gGd4/unsubscribe . To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
Thanks for the pointer Jen. When I run SDM directly rather than via intellij (using gwt:run-codeserver goal of the maven plugin), everything works. Whew. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: SDM bug when using AutoBean
This seems to be a bug with IntelliJ. When I run SDM outside of IntelliJ (via the gwt:run-codeserver goal of the maven plugin), everything works. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
I'm trying out AutoBean for the first time. Serializing a DTO to json on server works great, however when I attempt to deserialize it on the client side, I get this error: com.google.gwt.core.client.JavaScriptException: (ReferenceError) : Ljava_util_List_2_classLit_0_g$ is not defined Console.java:11 Unknown.endVisitType_1_g$(MyModule-0.js@7:63881) Unknown.traverse_1_g$(MyModule-0.js@18:61742) Unknown.accept_5_g$(MyModule-0.js@8:61692) Unknown.maybeCreateCoder_0_g$(MyModule-0.js@12:64206) Unknown.visitValueProperty_3_g$(MyModule-0.js@8:64221) Unknown.traverseProperties_0_g$(MyModule-0.js@20:4379) Unknown.traverse_0_g$(MyModule-0.js@10:4306) Unknown.accept_4_g$(MyModule-0.js@8:4171) Unknown.doCoderFor_0_g$(MyModule-0.js@17:63732) Unknown.getOrReify_0_g$(MyModule-0.js@16:4220) My code: final RequestBeanFactory factory = GWT.create(RequestBeanFactory.class); MyBean result = AutoBeanCodex.decode(factory, MyBean.class, response.getText()).as(); During logging I've verified that response.getText() is returning valid json (its the output of serialization via AutoBean on server) Any ideas? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
Is there a way to upgrade to the trunk version via maven? SNAPSHOT builds are currently disabled. However you can use https://github.com/manolo/gwt-snapshot/raw/master/ as a temporary maven repo. -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
When I downgrade to gwt 2.6.0 , the code above works without any modification. It seems that this is a bug within 2.7.0 which appears to be fixed in trunk. Is there a way to upgrade to the trunk version via maven? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
AutoBeanMyBean ab = AutoBeanCodex.decode(factory, MyBean.class, response. getText()); InitResult result = ab.as(); ab.as() returns MyBean and not InitResult. -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
Hi, just tested your code and actually seems to work using gwt/trunk so maybe it has something to do with the version you are using or the 'response' text. My EntryPoint: --- RequestBeanFactory factory = GWT.create(RequestBeanFactory.class); AutoBeanMyBean ab = AutoBeanCodex.decode(factory, MyBean.class, {\value\:\ciao\}); GWT.log(Decode 1); MyBean result = ab.as(); GWT.log(Decode 2: + result.toString()); GWT.log(Result: + result.getValue()); --- Browser console: Decode 1 SuperDevModeLogger.java:71 Decode 2: com..._MyBeanAutoBean$2@1 SuperDevModeLogger.java:71 Result: ciao - Cheers, A. On Fri Feb 06 2015 at 2:32:42 PM Ali Akhtar ali.rac...@gmail.com wrote: Seems like this error only occurs when I try to access a property of the deserialized bean. I changed my code to the following: Console.debug(Response-- + response.getText()); AutoBeanMyBean ab = AutoBeanCodex.decode(factory, MyBean.class, response .getText()); Console.debug(Decode 1); InitResult result = ab.as(); Console.debug(Decode 2: + result.toString()); Console.debug(Result: + result.getValue()); I now get the output: Response-- {value:tesst} Decode 1 Decode 2: com.myModule.MyBeanAutoBean$2@1 com.google.gwt.core.client.JavaScriptException: (ReferenceError) : Ljava_util_List_2_classLit_0_g$ is not defined Unknown.endVisitType_1_g$(MyModule-0.js@7:63876) Unknown.traverse_1_g$(MyModule-0.js@18:61737) Unknown.accept_5_g$(MyModule-0.js@8:61687) Unknown.maybeCreateCoder_0_g$(MyModule-0.js@12:64201) Unknown.visitValueProperty_3_g$(MyModule-0.js@8:64216) Unknown.traverseProperties_0_g$(MyModule-0.js@20:4376) Unknown.traverse_0_g$(MyModule-0.js@10:4303) Unknown.accept_4_g$(MyModule-0.js@8:4168) Unknown.doCoderFor_0_g$(MyModule-0.js@17:63727) Unknown.getOrReify_0_g$(MyModule-0.js@16:4217) Bean definition: public interface MyBean extends Serializable { public String getValue(); public void setValue(String value); } public interface RequestBeanFactory extends AutoBeanFactory { public AutoBeanMyBean myBean(); } Any ideas? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
Hi, the sample code i sent you actually works even if i switch to gwt 2.7. (superdevmode). In my sample i specify the json string inline; i'd try to do the same to investigate further. good luck, Alberto. On Fri Feb 06 2015 at 2:51:36 PM Ali Akhtar ali.rac...@gmail.com wrote: Jens, that was just a typo I made in pasting the code. The actual code has the right class name. Alberto, I'm on gwt 2.7.0 . Does it work with that? The json string is: {value:tesst} On Fri, Feb 6, 2015 at 6:47 PM, Alberto Mancini ab.manc...@gmail.com wrote: Hi, just tested your code and actually seems to work using gwt/trunk so maybe it has something to do with the version you are using or the 'response' text. My EntryPoint: --- RequestBeanFactory factory = GWT.create(RequestBeanFactory.class); AutoBeanMyBean ab = AutoBeanCodex.decode(factory, MyBean.class, {\value\:\ciao\}); GWT.log(Decode 1); MyBean result = ab.as(); GWT.log(Decode 2: + result.toString()); GWT.log(Result: + result.getValue()); --- Browser console: Decode 1 SuperDevModeLogger.java:71 Decode 2: com..._MyBeanAutoBean$2@1 SuperDevModeLogger.java:71 Result: ciao - Cheers, A. On Fri Feb 06 2015 at 2:32:42 PM Ali Akhtar ali.rac...@gmail.com wrote: Seems like this error only occurs when I try to access a property of the deserialized bean. I changed my code to the following: Console.debug(Response-- + response.getText()); AutoBeanMyBean ab = AutoBeanCodex.decode(factory, MyBean.class, response.getText()); Console.debug(Decode 1); InitResult result = ab.as(); Console.debug(Decode 2: + result.toString()); Console.debug(Result: + result.getValue()); I now get the output: Response-- {value:tesst} Decode 1 Decode 2: com.myModule.MyBeanAutoBean$2@1 com.google.gwt.core.client.JavaScriptException: (ReferenceError) : Ljava_util_List_2_classLit_0_g$ is not defined Unknown.endVisitType_1_g$(MyModule-0.js@7:63876) Unknown.traverse_1_g$(MyModule-0.js@18:61737) Unknown.accept_5_g$(MyModule-0.js@8:61687) Unknown.maybeCreateCoder_0_g$(MyModule-0.js@12:64201) Unknown.visitValueProperty_3_g$(MyModule-0.js@8:64216) Unknown.traverseProperties_0_g$(MyModule-0.js@20:4376) Unknown.traverse_0_g$(MyModule-0.js@10:4303) Unknown.accept_4_g$(MyModule-0.js@8:4168) Unknown.doCoderFor_0_g$(MyModule-0.js@17:63727) Unknown.getOrReify_0_g$(MyModule-0.js@16:4217) Bean definition: public interface MyBean extends Serializable { public String getValue(); public void setValue(String value); } public interface RequestBeanFactory extends AutoBeanFactory { public AutoBeanMyBean myBean(); } Any ideas? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to a topic in the Google Groups Google Web Toolkit group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/RzsjqX2gGd4/unsubscribe . To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
Jens, that was just a typo I made in pasting the code. The actual code has the right class name. Alberto, I'm on gwt 2.7.0 . Does it work with that? The json string is: {value:tesst} On Fri, Feb 6, 2015 at 6:47 PM, Alberto Mancini ab.manc...@gmail.com wrote: Hi, just tested your code and actually seems to work using gwt/trunk so maybe it has something to do with the version you are using or the 'response' text. My EntryPoint: --- RequestBeanFactory factory = GWT.create(RequestBeanFactory.class); AutoBeanMyBean ab = AutoBeanCodex.decode(factory, MyBean.class, {\value\:\ciao\}); GWT.log(Decode 1); MyBean result = ab.as(); GWT.log(Decode 2: + result.toString()); GWT.log(Result: + result.getValue()); --- Browser console: Decode 1 SuperDevModeLogger.java:71 Decode 2: com..._MyBeanAutoBean$2@1 SuperDevModeLogger.java:71 Result: ciao - Cheers, A. On Fri Feb 06 2015 at 2:32:42 PM Ali Akhtar ali.rac...@gmail.com wrote: Seems like this error only occurs when I try to access a property of the deserialized bean. I changed my code to the following: Console.debug(Response-- + response.getText()); AutoBeanMyBean ab = AutoBeanCodex.decode(factory, MyBean.class, response.getText()); Console.debug(Decode 1); InitResult result = ab.as(); Console.debug(Decode 2: + result.toString()); Console.debug(Result: + result.getValue()); I now get the output: Response-- {value:tesst} Decode 1 Decode 2: com.myModule.MyBeanAutoBean$2@1 com.google.gwt.core.client.JavaScriptException: (ReferenceError) : Ljava_util_List_2_classLit_0_g$ is not defined Unknown.endVisitType_1_g$(MyModule-0.js@7:63876) Unknown.traverse_1_g$(MyModule-0.js@18:61737) Unknown.accept_5_g$(MyModule-0.js@8:61687) Unknown.maybeCreateCoder_0_g$(MyModule-0.js@12:64201) Unknown.visitValueProperty_3_g$(MyModule-0.js@8:64216) Unknown.traverseProperties_0_g$(MyModule-0.js@20:4376) Unknown.traverse_0_g$(MyModule-0.js@10:4303) Unknown.accept_4_g$(MyModule-0.js@8:4168) Unknown.doCoderFor_0_g$(MyModule-0.js@17:63727) Unknown.getOrReify_0_g$(MyModule-0.js@16:4217) Bean definition: public interface MyBean extends Serializable { public String getValue(); public void setValue(String value); } public interface RequestBeanFactory extends AutoBeanFactory { public AutoBeanMyBean myBean(); } Any ideas? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to a topic in the Google Groups Google Web Toolkit group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/RzsjqX2gGd4/unsubscribe . To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
Seems like this error only occurs when I try to access a property of the deserialized bean. I changed my code to the following: AutoBeanMyBean ab = AutoBeanCodex.decode(factory, MyBean.class, response. getText()); Console.debug(Decode 1); InitResult result = ab.as(); Console.debug(Decode 2: + result.toString()); Console.debug(Result: + result.getValue()); I now get the output: Response-- {value:tesst} Decode 1 Decode 2: com.distancelearningsolution.shared.dto.InitResultAutoBean$2@1 com.google.gwt.core.client.JavaScriptException: (ReferenceError) : Ljava_util_List_2_classLit_0_g$ is not defined Unknown.endVisitType_1_g$(MyModule-0.js@7:63876) Unknown.traverse_1_g$(MyModule-0.js@18:61737) Unknown.accept_5_g$(MyModule-0.js@8:61687) Unknown.maybeCreateCoder_0_g$(MyModule-0.js@12:64201) Unknown.visitValueProperty_3_g$(MyModule-0.js@8:64216) Unknown.traverseProperties_0_g$(MyModule-0.js@20:4376) Unknown.traverse_0_g$(MyModule-0.js@10:4303) Unknown.accept_4_g$(MyModule-0.js@8:4168) Unknown.doCoderFor_0_g$(MyModule-0.js@17:63727) Unknown.getOrReify_0_g$(MyModule-0.js@16:4217) Bean definition: public interface MyBean extends Serializable { public String getValue(); public void setValue(String value); } public interface RequestBeanFactory extends AutoBeanFactory { public AutoBeanMyBean myBean(); } Any ideas? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )
Seems like this error only occurs when I try to access a property of the deserialized bean. I changed my code to the following: Console.debug(Response-- + response.getText()); AutoBeanMyBean ab = AutoBeanCodex.decode(factory, MyBean.class, response. getText()); Console.debug(Decode 1); InitResult result = ab.as(); Console.debug(Decode 2: + result.toString()); Console.debug(Result: + result.getValue()); I now get the output: Response-- {value:tesst} Decode 1 Decode 2: com.myModule.MyBeanAutoBean$2@1 com.google.gwt.core.client.JavaScriptException: (ReferenceError) : Ljava_util_List_2_classLit_0_g$ is not defined Unknown.endVisitType_1_g$(MyModule-0.js@7:63876) Unknown.traverse_1_g$(MyModule-0.js@18:61737) Unknown.accept_5_g$(MyModule-0.js@8:61687) Unknown.maybeCreateCoder_0_g$(MyModule-0.js@12:64201) Unknown.visitValueProperty_3_g$(MyModule-0.js@8:64216) Unknown.traverseProperties_0_g$(MyModule-0.js@20:4376) Unknown.traverse_0_g$(MyModule-0.js@10:4303) Unknown.accept_4_g$(MyModule-0.js@8:4168) Unknown.doCoderFor_0_g$(MyModule-0.js@17:63727) Unknown.getOrReify_0_g$(MyModule-0.js@16:4217) Bean definition: public interface MyBean extends Serializable { public String getValue(); public void setValue(String value); } public interface RequestBeanFactory extends AutoBeanFactory { public AutoBeanMyBean myBean(); } Any ideas? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
creating multiple instance of same autobean
Is there a way of creating two instances of same autobean? We are creating an autobean by decoding the JSON response. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
AutoBean unstable on server side
I think I've run across a known bug (https://code.google.com/p/google-web-toolkit/issues/detail?id=5926). I only wish I hadn't spent so long puzzling over it. I had been hand-rolling my server-side JSON, but as I would refactor interfaces, I found the JSON key strings on the server getting out-of-sync with my client side methods. After reading more on AutoBean, I figured I could create objects with the as() method, populate them, and then dump the payload back to my client. It looked slicker, and, if a method name was changed, Eclipse would do the work of updating stuff I might miss until I compiled and ran it. (And I'm using as() in my unit tests to avoid the time spent with a GWT.create() call.) For me this works fine with small objects, like a hand full of keys and maybe one small JSONArray. However when I attempted to create a much larger, more complex object--more keys, longers lists, and lists within lists, etc.--I'm seeing all sorts of bugs: A 13-member list with all members the same (the last value added), *many* fields missing in the JSON payload (upwards of hal!), and in one case, a setter method for a boolean that crashes with an IllegalArgumentException when called with a boolean! So far this on the server side (and Issue #5926 is specifically server). Since I dunno where the tipping point is, I'm going to pull *all* my server side AutoBean and, once again, hand-roll the JSON. Someone with access may want to annotate the AutoBean wikihttps://code.google.com/p/google-web-toolkit/wiki/AutoBeanwith this issue. Sucn a note may have saved me a lot of work. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: AutoBean polymorphism support
Hi , I am facing the same case in which i have to create a generic bean factory , this means that factory related to some super class , and all i have to do is to create sub classes from it and send and parse json data using it,the object coming from parsing json can be of any subclass of my super class, which from how i understand Auto Bean framework is the opposite of the point of it , so anyone can help me if there is a way , and if there is not please tell me and give me some official resource says its not impossible -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
2 instances of same autobean getting updated simultaneously
Have an autobean created after deserliazing the json response. Then I save it in two different files to the classmembers with getter and setter Class A MyBean bean = null; public MyBean getBean() { this.MyBean; } public void setBean(MyBean beanVal) { this.MyBean = beanVal; } Similarly in Class B. The reason to have the bean value at 2 places is :one bean value is referred as original or default and the other can be updated. So whenver user wants to Reset, default bean can be loaded. I am seeing a strange behaviour: when I update the bean from class A, bean value in class B is also updated. Please suggest how can I have 2 instance to solve my case. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
AutoBean returning ListObject
have an autobean that returns ListObject. The reason is the json key to which the getListVal() is mapped is an array of string and Integer values. After filling the autobean, I am able to get the size of getListVal properly but while iterating through the returned list, illegalArgument Exception is thrown. If I change the return type as String and have only string values in json key it works fine. Is there anything wrong have Object as return type in Autobeans? TestAutoBean.java : public ListObject getListVal(); code while iterating the getListVal returned list and accessing the elements - ListObject values= getListVal();*System.out*.println(params size = +values.size()); // this displays correct value String *s* =; *for* (*int* i = 0; i values.size(); i++) { s = (String)values.get(i); // This line throws java.lang.IllegalArgumentException: java.lang.Object . } For the above case the json key has only String value. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: AutoBean returning ListObject
AutoBeans do not support polymorphism, even for primitive values; and yes, that means you cannot work with mixed-type arrays. I think you could still work with your JSON object, but at a lower level: use Splittable instead of ListObject. On Wednesday, January 8, 2014 9:04:42 AM UTC+1, aditi wrote: have an autobean that returns ListObject. The reason is the json key to which the getListVal() is mapped is an array of string and Integer values. After filling the autobean, I am able to get the size of getListVal properly but while iterating through the returned list, illegalArgument Exception is thrown. If I change the return type as String and have only string values in json key it works fine. Is there anything wrong have Object as return type in Autobeans? TestAutoBean.java : public ListObject getListVal(); code while iterating the getListVal returned list and accessing the elements - ListObject values= getListVal(); *System.out*.println(params size = +values.size()); // this displays correct value String *s* =; *for* (*int* i = 0; i values.size(); i++) { s = (String)values.get(i); // This line throws java.lang.IllegalArgumentException: java.lang.Object . } For the above case the json key has only String value. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
update the property value in Autobean
Have a autobean that has get and set methods for property - status. String getStatus(); void setStatus(String status); There is a case where this status property will be updated by UI. Can we have the autobean property updated and get the updated value across application. Please suggest. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
autobean structure for a complex JSON
In autobeans, while decoding a complex json object , so we have to create an interface for every property in json object that has { } ?? If yes, then are we not creating large number of autobean interfaces even to fetch a simple json property value? Or is there a way to have a better hierarchy or autobean? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
JSON object to AutoBean via JSNI in DevMode
Hi, is there anything faster than final String payload = new JSONObject(jsonDataFromJSNI).toString(); dataBean = AutoBeanCodex.decode(factory, Data.class, payload); when in DevMode? The JSON data is embedded into the host page and not that tiny (worst case ~600kb uncompressed) and the above solution makes DevMode hang for about 3-5 seconds when refreshing the site. Thats kind of annoying and I just want to make sure I didn't miss a different solution for DevMode thats maybe faster. -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: JSON object to AutoBean via JSNI in DevMode
On Tuesday, August 27, 2013 10:21:28 AM UTC+2, Jens wrote: Hi, is there anything faster than final String payload = new JSONObject(jsonDataFromJSNI).toString(); dataBean = AutoBeanCodex.decode(factory, Data.class, payload); when in DevMode? The JSON data is embedded into the host page and not that tiny (worst case ~600kb uncompressed) and the above solution makes DevMode hang for about 3-5 seconds when refreshing the site. Thats kind of annoying and I just want to make sure I didn't miss a different solution for DevMode thats maybe faster. Use native JSON.stringify through JSNI? The problem with com.google.gwt.json is that it creates a lot of objects and uses a lot of JSNI which slows down DevMode. If you don't mind running a patched GWT, there are a few issues that need to be fixed (most of them have pending reviews): - Elemental JSON can't be used without bringing the whole Elemental (which breaks DevModehttps://code.google.com/p/google-web-toolkit/issues/detail?id=7481 ): https://gwt-review.googlesource.com/4210 - Some of Elemental JSON is broken in prod mode (OK, not really relevant here): https://gwt-review.googlesource.com/4050 - Some of Elemental JSON is broken in dev mode: https://code.google.com/p/google-web-toolkit/issues/detail?id=7484 (partly fixed by above review) Once that's fixed, you could then use: payload = ((JsJsonValue) jsonDataFromJSNI).toJson(); (note: uses JSON.stringify under-the-hood) The next step will be to port AutoBean to use elemental.json instead of org.json and add an overload to AutoBeanCodex.decode that takes a JsonValue. (side note: the data you get from the page is JS, not JSON; JSON is a serialization format, if you have objects, then it's JS, possibly expressed as JS literals; this is one reason why JSON-P is completely misnamed: there's no JSON in JSON-P, at all) -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: JSON object to AutoBean via JSNI in DevMode
Use native JSON.stringify through JSNI? The problem with com.google.gwt.json is that it creates a lot of objects and uses a lot of JSNI which slows down DevMode. Ok JSON.stringify helps quite a bit. Now its basically if (GWT.isScript()) { dataBean = AutoBeanCodex.decode(factory, Data.class, (JsoSplittable) getDataAsJsoFromJSNI()); } else { //JsoSplittable is @GwtScriptOnly so we need something different for DevMode dataBean = AutoBeanCodex.decode(factory, AppInitData.class, getDataAsStringFromJSNI()); } (side note: the data you get from the page is JS, not JSON; JSON is a serialization format, if you have objects, then it's JS, possibly expressed as JS literals; this is one reason why JSON-P is completely misnamed: there's no JSON in JSON-P, at all) Yeah of course I get a JSO. Just a bad habit when naming it directly JSON. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem decoding complex AutoBean
You don't seem to have an AutoBean interface with a MQuery getMquery() method. The object you're parsing has only a mquery property, so if you look at it as if it were an MQuery object, getScreenname and getFields would expectedly be null. On Tuesday, August 20, 2013 4:37:30 AM UTC+2, Thad Humphries wrote: I've managed a simple AutoBean with a list. Now I've a more complex one, and I don't understand what's wrong. My get methods are returning null though the debugger shows the object has data. The JSON looks like this: { mquery: { screenname:Index Card, fields: { field:[ {title:Name, name:odname, value:*TIFF*}, {title:Date, name:oddate, value:}, {title:Ref #, name:odrefnum, value:} ] } } } I have three interfaces: public interface Field { String getTitle(); void setTitle(String title); String getName(); void setName(String name); String getValue(); void setValue(String value); } public interface FieldList { ListField getField(); void setField(ListField field); } public interface MQuery { String getScreenname(); void setScreenname(String screenname); FieldList getFields(); void setFields(FieldList fields); } In my bean factory, I have public interface BeanFactory extends AutoBeanFactory { ... AutoBeanField field(); AutoBeanFieldList fields(); AutoBeanMQuery mquery(); } In my onResponseReceived() method, I call AutoBeanMQuery mqueryBean = AutoBeanCodex.decode(clientFactory.getBeanFactory(), MQuery.class, response.getText()); MQuery mQuery = mqueryBean.as(); logger.log(Level.INFO, mQuery.getScreenname()); screenName = mQuery.getScreenname(); fieldList = mQuery.getFields().getField(); view.renderFields(fieldList); When I look at the debugger in Chrome, screenname, etc are populated (in mQuery:this$0:data_0 there is mquery with screenename set and 3 field objects in fields). However mQuery.getScreenname() returns null as does mQuery.getFields(). What am I not seeing here? Could the presence of other AutoBeans in my factory (beans that work) be messing me up (do I need a separate factory)? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem decoding complex AutoBean
Thank you, Thomas. That worked. I added the interface public interface MQueryWrapper { MQuery getMquery(); } In BeanFactory, I changed AutoBeanMQuery mquery(); for AutoBeanMQueryWrapper mquery(); My onResponseReceived() now looks like AutoBeanMQueryWrapper bean = AutoBeanCodex.decode(clientFactory.getBeanFactory(), MQueryWrapper.class, response.getText()); MQuery mQuery = bean.as().getMquery(); logger.log(Level.INFO, mQuery.getScreenname()); screenName = mQuery.getScreenname(); fieldList = mQuery.getFields().getField(); view.renderFields(fieldList); Client-side this beats overlay types because it can handle nested objects (so long as I figure out nesting). I've not tried it server-side yet, but that looks *very* handy. However it's probably wise at this early stage to come up with better tags than field and fields for the XML that my JSON originates from. As more structures are added, I may have conflicts. (I wonder if JSON's XML.toJSONObject() does some magic with namespaces...) On Tuesday, August 20, 2013 5:34:03 AM UTC-4, Thomas Broyer wrote: You don't seem to have an AutoBean interface with a MQuery getMquery() method. The object you're parsing has only a mquery property, so if you look at it as if it were an MQuery object, getScreenname and getFields would expectedly be null. On Tuesday, August 20, 2013 4:37:30 AM UTC+2, Thad Humphries wrote: I've managed a simple AutoBean with a list. Now I've a more complex one, and I don't understand what's wrong. My get methods are returning null though the debugger shows the object has data. The JSON looks like this: { mquery: { screenname:Index Card, fields: { field:[ {title:Name, name:odname, value:*TIFF*}, {title:Date, name:oddate, value:}, {title:Ref #, name:odrefnum, value:} ] } } } I have three interfaces: public interface Field { String getTitle(); void setTitle(String title); String getName(); void setName(String name); String getValue(); void setValue(String value); } public interface FieldList { ListField getField(); void setField(ListField field); } public interface MQuery { String getScreenname(); void setScreenname(String screenname); FieldList getFields(); void setFields(FieldList fields); } In my bean factory, I have public interface BeanFactory extends AutoBeanFactory { ... AutoBeanField field(); AutoBeanFieldList fields(); AutoBeanMQuery mquery(); } In my onResponseReceived() method, I call AutoBeanMQuery mqueryBean = AutoBeanCodex.decode(clientFactory.getBeanFactory(), MQuery.class, response.getText()); MQuery mQuery = mqueryBean.as(); logger.log(Level.INFO, mQuery.getScreenname()); screenName = mQuery.getScreenname(); fieldList = mQuery.getFields().getField(); view.renderFields(fieldList); When I look at the debugger in Chrome, screenname, etc are populated (in mQuery:this$0:data_0 there is mquery with screenename set and 3 field objects in fields). However mQuery.getScreenname() returns null as does mQuery.getFields(). What am I not seeing here? Could the presence of other AutoBeans in my factory (beans that work) be messing me up (do I need a separate factory)? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem decoding complex AutoBean
On Tuesday, August 20, 2013 1:47:58 PM UTC+2, Thad Humphries wrote: Thank you, Thomas. That worked. I added the interface public interface MQueryWrapper { MQuery getMquery(); } In BeanFactory, I changed AutoBeanMQuery mquery(); for AutoBeanMQueryWrapper mquery(); My onResponseReceived() now looks like AutoBeanMQueryWrapper bean = AutoBeanCodex.decode(clientFactory.getBeanFactory(), MQueryWrapper.class, response.getText()); MQuery mQuery = bean.as().getMquery(); logger.log(Level.INFO, mQuery.getScreenname()); screenName = mQuery.getScreenname(); fieldList = mQuery.getFields().getField(); view.renderFields(fieldList); Client-side this beats overlay types because it can handle nested objects (so long as I figure out nesting). Why wouldn't you be able to do it with JSOs? I've not tried it server-side yet, but that looks *very* handy. Yup, I'm using it to serialize some datahttps://github.com/tbroyer/gwt-maven-archetypes/blob/598bed4f16a52d97b21a5f0fa9a3ce65650903a4/guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/ServerUser.java#L29that I output in the host pagehttps://github.com/tbroyer/gwt-maven-archetypes/blob/598bed4f16a52d97b21a5f0fa9a3ce65650903a4/guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/index.jsp#L70 and load on the client-side at startuphttps://github.com/tbroyer/gwt-maven-archetypes/blob/598bed4f16a52d97b21a5f0fa9a3ce65650903a4/guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__GinModule.java#L74, works great and you're sure that your JSON will be understood by the end and don't fear forgetting to update the code on one side and not the other. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem decoding complex AutoBean
On Tuesday, August 20, 2013 8:40:47 AM UTC-4, Thomas Broyer wrote: On Tuesday, August 20, 2013 1:47:58 PM UTC+2, Thad Humphries wrote: Thank you, Thomas. That worked. I added the interface public interface MQueryWrapper { MQuery getMquery(); } In BeanFactory, I changed AutoBeanMQuery mquery(); for AutoBeanMQueryWrapper mquery(); My onResponseReceived() now looks like AutoBeanMQueryWrapper bean = AutoBeanCodex.decode(clientFactory.getBeanFactory(), MQueryWrapper.class, response.getText()); MQuery mQuery = bean.as().getMquery(); logger.log(Level.INFO, mQuery.getScreenname()); screenName = mQuery.getScreenname(); fieldList = mQuery.getFields().getField(); view.renderFields(fieldList); Client-side this beats overlay types because it can handle nested objects (so long as I figure out nesting). Why wouldn't you be able to do it with JSOs? Ah, thank you for that little programming problem. I was missing something when I previously looked at overlay types. Yes, they can handle nested objects. Assuming the same JSON structure as above, these two objects manage it: public class MQueryField extends JavaScriptObject { protected MQueryField() {} public final native String getTitle() /*-{ return this.title; }-*/; public final native String getName() /*-{ return this.name; }-*/; public final native String getValue() /*-{ return this.value; }-*/; } public class MQueryRoot extends JavaScriptObject { protected MQueryRoot() {} public final native String getScreenName() /*-{ return this.screenname; }-*/; public final native JsArrayMQueryField getFields() /*-{ return this.fields.field; }-*/; } Now reading in that same string: JSONObject jobj = new JSONObject(JsonUtils.safeEval(response.getText())); MQueryRoot root = jobj.get(mquery).isObject().getJavaScriptObject().cast(); logger.log(Level.INFO, root.getScreenName()); // prints Index Card logger.log(Level.INFO, fields[+root.getFields().length()+]); // prints fields[3] Hm… I think I prefer AutoBeans, but this is nice to know. I've not tried it server-side yet, but that looks *very* handy. Yup, I'm using it to serialize some datahttps://github.com/tbroyer/gwt-maven-archetypes/blob/598bed4f16a52d97b21a5f0fa9a3ce65650903a4/guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/ServerUser.java#L29that I output in the host pagehttps://github.com/tbroyer/gwt-maven-archetypes/blob/598bed4f16a52d97b21a5f0fa9a3ce65650903a4/guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/index.jsp#L70 and load on the client-side at startuphttps://github.com/tbroyer/gwt-maven-archetypes/blob/598bed4f16a52d97b21a5f0fa9a3ce65650903a4/guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__GinModule.java#L74, works great and you're sure that your JSON will be understood by the end and don't fear forgetting to update the code on one side and not the other. Thank you for these examples. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem decoding complex AutoBean
JSONObject jobj = new JSONObject(JsonUtils.safeEval(response.getText())); MQueryRoot root = jobj.get(mquery).isObject().getJavaScriptObject().cast(); If you want that code a bit easier to read you could use a MQueryWrapper JSO like in the AutoBean example and then write MQueryWrapper wrapper = JsonUtils.safeEval(response.getText()); MQueryRoot root = wrapper.getMQuery(); So at the end its like: calling .as() vs. implementing JSO's by hand/via code generation. -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Problem decoding complex AutoBean
I've managed a simple AutoBean with a list. Now I've a more complex one, and I don't understand what's wrong. My get methods are returning null though the debugger shows the object has data. The JSON looks like this: { mquery: { screenname:Index Card, fields: { field:[ {title:Name, name:odname, value:*TIFF*}, {title:Date, name:oddate, value:}, {title:Ref #, name:odrefnum, value:} ] } } } I have three interfaces: public interface Field { String getTitle(); void setTitle(String title); String getName(); void setName(String name); String getValue(); void setValue(String value); } public interface FieldList { ListField getField(); void setField(ListField field); } public interface MQuery { String getScreenname(); void setScreenname(String screenname); FieldList getFields(); void setFields(FieldList fields); } In my bean factory, I have public interface BeanFactory extends AutoBeanFactory { ... AutoBeanField field(); AutoBeanFieldList fields(); AutoBeanMQuery mquery(); } In my onResponseReceived() method, I call AutoBeanMQuery mqueryBean = AutoBeanCodex.decode(clientFactory.getBeanFactory(), MQuery.class, response.getText()); MQuery mQuery = mqueryBean.as(); logger.log(Level.INFO, mQuery.getScreenname()); screenName = mQuery.getScreenname(); fieldList = mQuery.getFields().getField(); view.renderFields(fieldList); When I look at the debugger in Chrome, screenname, etc are populated (in mQuery:this$0:data_0 there is mquery with screenename set and 3 field objects in fields). However mQuery.getScreenname() returns null as does mQuery.getFields(). What am I not seeing here? Could the presence of other AutoBeans in my factory (beans that work) be messing me up (do I need a separate factory)? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Is ValueProxy similar to AutoBean type object?
On Friday, June 14, 2013 8:03:57 PM UTC+2, Yan wrote: Hi, With my GWT 2.5.1, I am revisit the way I am using EntityProxy. There is an existing post about a parent entity proxy holding a list of children entity proxy, changes in children in UI does not trigger an update in backend. So, I thought to change to use ValueProxy, that way, I do not have this problem, as everything is sent to server. There is not that much data, so it won't be a performance problem. But, is not using AutoBean more straightforward? Just define an interface, both client/server are serializing and unserializing the objects into JSON string. Is ValueProxy essentially the same as object being serialized using AutoBean? If you don't need/use the other features of RequestFactory (batching, graphs that reuse the same object several times, bean validation, EntityProxyChange event, polymorphism) then yes. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Is ValueProxy similar to AutoBean type object?
Hi, With my GWT 2.5.1, I am revisit the way I am using EntityProxy. There is an existing post about a parent entity proxy holding a list of children entity proxy, changes in children in UI does not trigger an update in backend. So, I thought to change to use ValueProxy, that way, I do not have this problem, as everything is sent to server. There is not that much data, so it won't be a performance problem. But, is not using AutoBean more straightforward? Just define an interface, both client/server are serializing and unserializing the objects into JSON string. Is ValueProxy essentially the same as object being serialized using AutoBean? Thanks, Yan -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problems with AutoBean Lists
Have you searched the issue tracker for any existing issue? If there isn't any, could you please open one? (and otherwise, please comment on it to link to this thread) On Tuesday, February 5, 2013 5:27:19 PM UTC+1, Sebastian Metzger wrote: Just had the same problem Seems to be a bug in the AutoBean List implementation I solved it by simply: autoBean.setList(new ArrayListType(autoBean.getList)); On Tuesday, January 31, 2012 10:51:17 PM UTC+1, Cypher wrote: I am having problems modifying a list property on an AutoBean deserialized from JSON with AutoBeanCodex. When I call List.add(position, value) it appears to be overwriting the value at that position instead of shifting values right to make room for the new item. Here's a JUnit test that demonstrates the behavior I'm seeing: public class AutoBeanListTest extends GWTTestCase { @Override public String getModuleName() { return com.xxx.AutoBeanListTest; } @Test public void testDirectInsert() { MyBeanFactory factory = GWT.create(MyBeanFactory.class); MyBean bean = factory.myBean().as(); bean.setValues(new ArrayListString()); bean.getValues().add(A); bean.getValues().add(C); assertEquals(2,bean.getValues().size()); bean.getValues().add(1,B); assertEquals(3,bean.getValues().size()); // this one works assertEquals(A, bean.getValues().get(0)); assertEquals(B, bean.getValues().get(1)); assertEquals(C, bean.getValues().get(2)); } @Test public void testSerializeInsert() { MyBeanFactory factory = GWT.create(MyBeanFactory.class); MyBean bean = factory.myBean().as(); bean.setValues(new ArrayListString()); bean.getValues().add(A); bean.getValues().add(C); assertEquals(2,bean.getValues().size()); String json = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(bean)).getPayload(); bean = AutoBeanCodex.decode(factory, MyBean.class, json).as(); assertEquals(2,bean.getValues().size()); bean.getValues().add(1,B); assertEquals(3,bean.getValues().size()); // this one FAILS assertEquals(A, bean.getValues().get(0)); assertEquals(B, bean.getValues().get(1)); assertEquals(C, bean.getValues().get(2)); } public interface MyBeanFactory extends AutoBeanFactory { AutoBeanMyBean myBean(); AutoBeanMyBean myBean(MyBean myBean); } public interface MyBean { ListString getValues(); void setValues(ListString values); } } The first test case (which modifies a list that I create and put into the bean) works as I expect, but the second test (which modifies the list returned from deserialization) does not. After the insert, the list still has only two values in it, and the second one has been replaced by the value I inserted. Am I doing something wrong? Is this an issue in the underlying code? I can't help but notice that the SplittableList class uses the same implementation for set() and add(). That doesn't seem right to me, but I assume I must be missing something. James -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problems with AutoBean Lists
Just had the same problem Seems to be a bug in the AutoBean List implementation I solved it by simply: autoBean.setList(new ArrayListType(autoBean.getList)); On Tuesday, January 31, 2012 10:51:17 PM UTC+1, Cypher wrote: I am having problems modifying a list property on an AutoBean deserialized from JSON with AutoBeanCodex. When I call List.add(position, value) it appears to be overwriting the value at that position instead of shifting values right to make room for the new item. Here's a JUnit test that demonstrates the behavior I'm seeing: public class AutoBeanListTest extends GWTTestCase { @Override public String getModuleName() { return com.xxx.AutoBeanListTest; } @Test public void testDirectInsert() { MyBeanFactory factory = GWT.create(MyBeanFactory.class); MyBean bean = factory.myBean().as(); bean.setValues(new ArrayListString()); bean.getValues().add(A); bean.getValues().add(C); assertEquals(2,bean.getValues().size()); bean.getValues().add(1,B); assertEquals(3,bean.getValues().size()); // this one works assertEquals(A, bean.getValues().get(0)); assertEquals(B, bean.getValues().get(1)); assertEquals(C, bean.getValues().get(2)); } @Test public void testSerializeInsert() { MyBeanFactory factory = GWT.create(MyBeanFactory.class); MyBean bean = factory.myBean().as(); bean.setValues(new ArrayListString()); bean.getValues().add(A); bean.getValues().add(C); assertEquals(2,bean.getValues().size()); String json = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(bean)).getPayload(); bean = AutoBeanCodex.decode(factory, MyBean.class, json).as(); assertEquals(2,bean.getValues().size()); bean.getValues().add(1,B); assertEquals(3,bean.getValues().size()); // this one FAILS assertEquals(A, bean.getValues().get(0)); assertEquals(B, bean.getValues().get(1)); assertEquals(C, bean.getValues().get(2)); } public interface MyBeanFactory extends AutoBeanFactory { AutoBeanMyBean myBean(); AutoBeanMyBean myBean(MyBean myBean); } public interface MyBean { ListString getValues(); void setValues(ListString values); } } The first test case (which modifies a list that I create and put into the bean) works as I expect, but the second test (which modifies the list returned from deserialization) does not. After the insert, the list still has only two values in it, and the second one has been replaced by the value I inserted. Am I doing something wrong? Is this an issue in the underlying code? I can't help but notice that the SplittableList class uses the same implementation for set() and add(). That doesn't seem right to me, but I assume I must be missing something. James -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
How to get JSONObject out of a deserialized AutoBean?
Hi, I serialize one of my beans with AutoBeanCodex.encode(bean).getPayload(); But when I'm trying to import and decode the same string, I do not want the AutoBean Proxy Object. I just want to have the JSONObject itself. The following will still give me the AB Proxy. How can I get the real object? MyBeanInterface bean = AutoBeanCodex.decode(factory, MyBeanInterface.class, jsonString).unwrap(); java.lang.IllegalStateException at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.unwrap(AbstractAutoBean.java:173) at My.deserialize(My.java:40) Why am I getting a exception if I'm decoding a Autobean the same way as I'm serializing it? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to get JSONObject out of a deserialized AutoBean?
On Monday, February 4, 2013 4:32:52 PM UTC+1, membersound wrote: Hi, I serialize one of my beans with AutoBeanCodex.encode(bean).getPayload(); But when I'm trying to import and decode the same string, I do not want the AutoBean Proxy Object. I just want to have the JSONObject itself. The following will still give me the AB Proxy. How can I get the real object? MyBeanInterface bean = AutoBeanCodex.decode(factory, MyBeanInterface.class, jsonString).unwrap(); Can't you just do a new JSONObject(jsonString) (or JSONPArser.parseStrict(jsonString).isObject(), depending which JSONObject you're talking about) Alternatively, if you want a JavaScriptObject, use JsonUtils.safeEval(jsonString); java.lang.IllegalStateException at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.unwrap(AbstractAutoBean.java:173) at My.deserialize(My.java:40) Why am I getting a exception if I'm decoding a Autobean the same way as I'm serializing it? unwrap() is for the case when you're wrapping an instance of some object implementing the MyBeanInterface interface inside an AutoBean (when your AutoBeanFactory has a method that takes a MyBeanInterface argument and returns an AutoBeanMyBeanInterface or when you use the AutoBeanFactory#create() that takes 2 arguments) -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
RequestFactory - AutoBean has been frozen - Reloading and editing
I realize this topic has been discussed before but I am having trouble finding a solution to my problem. Basically I have an editor that needs to edit the same entity in the database multiple times. I can edit the entity the first time but subsequent edits create the AutoBean has been frozen exception. The whole idea of this code it to load an entity, save the entity, reload the entity, save the entity On the server I am just looking up the entity from the database and returning the result. Here is the relevant code: editor.addSaveHandler(new SaveHandler() { @Override public void onSave(final SaveEvent event) { save(); } }); edit(); public void edit() { driver = GWT.create(Driver.class); driver.initialize(factory, editor); context = factory.context(); context.getRegisteredCompany().with(driver.getPaths()) .fire(new RFReceiverRegisteredCompanyProxy(eventBus, driver) { @Override public void onSuccess(final RegisteredCompanyProxy company) { context = factory.context(); driver.edit(company, context); context.save(company); } }); } public void save() { RequestContext ctx = driver.flush(); if (!driver.hasErrors()) { ctx.fire(new RFReceiverVoid(eventBus, driver) { @Override public void onSuccess(final Void response) { edit(); } }); } } Is there something that I am doing wrong with this code? Thanks! Steve -- You received this message because you are subscribed to the Google Groups Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: AutoBean with Subclasses
Think about this question from the other way around - same interfaces, but now look at the data itself, the JSON: {name:foo, shape:bar} What is that? Is it a Binterface with its other properties null? Is it a Cinterface with its other properties null? {name:foo, radius:100, height:200} What is that? Is it a Binterface with a useless extra radius property, or a Cinterface with a useless extra height property? The problem is that JSON doesn't have any built-in type information (by design), so AutoBeans can't magically decide what you meant. All of the cases above are legal, though annoying, but thats the nature of the beast. Generally, when I'm solving this, I have additional type information in the parent (i.e. the containing object, in this case Dinterface), or I know what type I expect based on context. Then, you can refer to that property as a Splittable (i.e. the raw data), and encode with any new information you get: public interface Dinterface { Splittable getA(); void setA(Splittable a); } Dinterface outer = ...; if (isC(outer)) { Cinterface inner = AutoBeanCodex.decode(factory, Cinterface.class, outer.getA()); //... } else if (isB(outer)) { Binterface inner = AutoBeanCodex.decode(factory, Binterface.class, outer.getA()); //... } else { //unsupported data type, decide what to do now } This could clearly be rewritten to have some getType(outer) method that returns Cinterface.class or Binterface.class - the idea is the same, just a different way to write it. Note too that if the inner data has some property you need to read to check that type, you can get it out of the splittable directly - something like outer.getA().get(typeData). I wrote a quick experiment to see if the @PropertyName annotation could be used in the outer interface to let it read the same property in two different ways - turns out this doesn't work: interface Dinterface { //DOES NOT WORK, DO NOT DO THIS @PropertyName(a) Binterface getB(); @PropertyName(a) Cinterface getC(); } I haven't dug too much deeper, but I suspect it is because when you invoke one of these methods, it looks for what type it has been told that a is, and decodes it as such. It doesn't pick the specific method you called, as it only wants to decode once (this stores it in the AbstractAutoBean.reified map) for cheaper subsequent lookups. Giving it two different types confuses it. So stick with Splittable as a property, decide what type you really want, and then decode that object. Or pick a tool other than JSON to solve your problem. On Friday, January 18, 2013 12:10:34 PM UTC-6, vb8...@gmail.com wrote: Did you get solution to this problem? On Tuesday, July 31, 2012 3:20:21 AM UTC-4, rkulisas wrote: Hi, I have 4 interfaces: public interface Ainterface{ getName()/setName(); getShape()/setShape(); } public interface Binterface extends Ainterface{ getWidth()/setWidth(); getHeight()/setHeight(); ... } public interface Cinterface extends Ainterface{ getRadius()/setRadius(); ... } public interface Dinterface { Ainterface getA(); void setA(Ainterface a); ... } I have included all interfaces in my AutoBeanFactory. Question: when I decode/encode Dinterface, how do I know if Ainterface is extended by Binterface or Cinterface? How does AutoBean support polymorphism? To make it easier, I can add a variable (for ex, shape) in Ainterface to indicate which Binterface or Cinterface I have and then cast Ainterface to Binterface/Cinterface. However, I run into ClassCastException. Should I have separate interfaces; one that consists Binterface and one consists Cinterface? Is there other solution to this problem? Thank you, -- 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/-/sjjAHvm7C8oJ. 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.
Re: AutoBean with Subclasses
Did you get solution to this problem? On Tuesday, July 31, 2012 3:20:21 AM UTC-4, rkulisas wrote: Hi, I have 4 interfaces: public interface Ainterface{ getName()/setName(); getShape()/setShape(); } public interface Binterface extends Ainterface{ getWidth()/setWidth(); getHeight()/setHeight(); ... } public interface Cinterface extends Ainterface{ getRadius()/setRadius(); ... } public interface Dinterface { Ainterface getA(); void setA(Ainterface a); ... } I have included all interfaces in my AutoBeanFactory. Question: when I decode/encode Dinterface, how do I know if Ainterface is extended by Binterface or Cinterface? How does AutoBean support polymorphism? To make it easier, I can add a variable (for ex, shape) in Ainterface to indicate which Binterface or Cinterface I have and then cast Ainterface to Binterface/Cinterface. However, I run into ClassCastException. Should I have separate interfaces; one that consists Binterface and one consists Cinterface? Is there other solution to this problem? Thank you, -- 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/-/8WhkOs0iwTAJ. 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.
Re: RequestFactory / AutoBean with non-bean value type
For what it is worth we have done the ServiceLayerDecorator and @SkipInterfaceValidation approach and it seems OK (keeps domain code cleaner at least) with GWT 2.5. On Thursday, September 15, 2011 11:31:37 AM UTC+1, Thomas Broyer wrote: I don't think ServiceLayerDecorator would work (interface won't validate against domain object; you could use @SkipInterfaceValidation but that actually wouldn't help, at least with GWT 2.4.0: see my comments on http://code.google.com/p/google-web-toolkit/source/detail?r=10542). How about adding getters and setters to your domain object that do the conversion between JodaTime types and strings or numbers? I.e. public final String getDurationString() { return getDuration().toString(); } public final void setDurationString(String s) { setDuration(Duration.parse(s)); } Not ideal but assured to work. Ideally of course, ValueCodex would be pluggable. If you have an idea how to refactor it so anyone could plug his codecs, that'd be awesome ;-) -- 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/-/769ePAcM-vgJ. 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.
Date in autobean
Hello, Is there a way to specify the format of the date with autobean? I'd like to use the ISO8601 format (-MM-dd hh:mm:ss.SSS), because the default transfer mode is the number of millisecond since 1970-01-01 and I cannot manage negative number for date older than 1970 on server side... -- 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/-/W0JzF06ZqEsJ. 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.
Date and Autobean
Hello, With Autobean Date must be a long in JSON structure. Is there a way to map Date to a specify pattern (like ISO-8601 -MM-DDThh:mm:ss.sTZD ) ? -- 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/-/SSnxXVcjstcJ. 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.
Re: AutoBean polymorphism support
Thanks, you confirmed my suspicions. Are you saying I can use Splittable to achieve polymorphism? How? Have you ever tried? Of course I can somehow get rid of polymorphism in my classes, but I'd rather do not. On Saturday, October 13, 2012 1:41:46 PM UTC+2, Thomas Broyer wrote: No, AutoBean has no mean to support polymorphism, and it specifically cannot be used for your use-case. You can possibly use Splittable, at a lower-level, or Elemental's JSON, JS overlays, or JSONObject. On Saturday, October 13, 2012 12:40:16 PM UTC+2, Andrea Boscolo wrote: Hi all, I am developing an app in which I use (or at least I would like to use) AutoBeans for serializing data. Unfortunately it seems to me that polymorphism is not supported i.e., I lost the concrete type once I deserialize the json in client-side, only the Base supertype is available. I looked everywhere but I haven't found some concrete answer, so I hope someone has already faced (and why not, solved) this problem. I created a really simple testcase that can be found on https://gist.github.com/3884099 I know AutoBean is behind RequestFactory so I though it supports polymorphism as well. I don't want to rely on RF as I do not need such complexity, I just simply need a way to serialize beans using AutoBean, but polymorphism is a must. Is is even achievable? Hope someone can help. Thanks in advance, Andrew. -- 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/-/rQYMv74T3lMJ. 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.
AutoBean polymorphism support
Hi all, I am developing an app in which I use (or at least I would like to use) AutoBeans for serializing data. Unfortunately it seems to me that polymorphism is not supported i.e., I lost the concrete type once I deserialize the json in client-side, only the Base supertype is available. I looked everywhere but I haven't found some concrete answer, so I hope someone has already faced (and why not, solved) this problem. I created a really simple testcase that can be found on https://gist.github.com/3884099 I know AutoBean is behind RequestFactory so I though it supports polymorphism as well. I don't want to rely on RF as I do not need such complexity, I just simply need a way to serialize beans using AutoBean, but polymorphism is a must. Is is even achievable? Hope someone can help. Thanks in advance, Andrew. -- 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/-/Cs0GC6ilJSMJ. 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.
Re: AutoBean polymorphism support
No, AutoBean has no mean to support polymorphism, and it specifically cannot be used for your use-case. You can possibly use Splittable, at a lower-level, or Elemental's JSON, JS overlays, or JSONObject. On Saturday, October 13, 2012 12:40:16 PM UTC+2, Andrea Boscolo wrote: Hi all, I am developing an app in which I use (or at least I would like to use) AutoBeans for serializing data. Unfortunately it seems to me that polymorphism is not supported i.e., I lost the concrete type once I deserialize the json in client-side, only the Base supertype is available. I looked everywhere but I haven't found some concrete answer, so I hope someone has already faced (and why not, solved) this problem. I created a really simple testcase that can be found on https://gist.github.com/3884099 I know AutoBean is behind RequestFactory so I though it supports polymorphism as well. I don't want to rely on RF as I do not need such complexity, I just simply need a way to serialize beans using AutoBean, but polymorphism is a must. Is is even achievable? Hope someone can help. Thanks in advance, Andrew. -- 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/-/5xKnC_KM-pUJ. 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.
[gwt-contrib] Re: Using RequestFactory, AutoBean equality compares stableId proxyClass, which will NPE if stableId is not set.
Hi Thomas. Sorry for this bit of thread necromancy, but this issue is still a big pain for us. I think I've figured out what's going on. We currently use ValueProxy objects that aren't contained inside an EntityProxy. And our ValueProxy objects don't have an @Id annotated field. So they would have no stableId associated with them right? According to the RequestFactory documentation: Unlike an EntityProxy, a ValueProxy is not required to expose an ID and version. ValueProxy is often used to represent embedded object types within entities So that means ValueProxy doesn't have to have its own ID, and it is only usually (but not always) contained in an Entity... So sounds to me like its not a bug for a ValueProxy to lack a stableId, so a null check on the stable ID in ValueProxyCategoy doesn't seem that crazy to me. What am I missing? Is the documentation not correct should it say ValueProxy objects don't need to have their own ID, but if they don't they must be contained within an EntityProxy?. It's definitely a very strange use case. This wouldn't be so hard for us except that we are using ValueProxy beans that are autogenerated for us, and it is not trivial to simply slap an @Id on one of the columns. Thanks, On Thursday, July 12, 2012 2:19:51 AM UTC-7, Thomas Broyer wrote: On Thursday, July 12, 2012 2:56:06 AM UTC+2, Eric Friesen wrote: This occurs in the ValueProxyCategory: http://code.google.com/searchframe#T04cSGC7sWI/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/ValueProxyCategory.javaq=ValueProxyCategory%20package:google-web-toolkit%5C.googlecode%5C.coml=42 It's causing our project to not be able to compare our AutoBean objects returned to us from RequestFactory requests. Would a change to check whether the AutoBeans have stable ids in the first place before trying to compare their proxy classes be acceptable? Or am I missing something in the big picture here and it's a bad idea. As far as I can tell it's an optimization to fail early without having to do a deep equals and this change would be alright. If this sounds reasonable I'll put in a fix for review. The thing is: stableId shouldn't ever be 'null', that'd be a bug. Maybe you create a ValueProxy AutoBean without using RequestContext#create(); that's not supported, that'd be a bug in your code. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
AutoBean with Subclasses
Hi, I have 4 interfaces: public interface Ainterface{ getName()/setName(); getShape()/setShape(); } public interface Binterface extends Ainterface{ getWidth()/setWidth(); getHeight()/setHeight(); ... } public interface Cinterface extends Ainterface{ getRadius()/setRadius(); ... } public interface Dinterface { Ainterface getA(); void setA(Ainterface a); ... } I have included all interfaces in my AutoBeanFactory. Question: when I decode/encode Dinterface, how do I know if Ainterface is extended by Binterface or Cinterface? How does AutoBean support polymorphism? To make it easier, I can add a variable (for ex, shape) in Ainterface to indicate which Binterface or Cinterface I have and then cast Ainterface to Binterface/Cinterface. However, I run into ClassCastException. Should I have separate interfaces; one that consists Binterface and one consists Cinterface? Is there other solution to this problem? Thank you, -- 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/-/WwTERx0IZRsJ. 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.
AutoBean Category Implementation Inheritance
When using AutoBean Categories Given: I have two interfaces, A and B B extends A I have a Category class for each, ACategory and BCategory I have an @Category annotation on my ObjectFactory for each Question: will the AutoBean produced by factory.b() have the methods implemented in ACategory and in BCategory, or only those in BCategory? -- 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/-/thOpW1s5cIEJ. 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.
GWT 2.4 AutoBean example not working
You need org.json classes in your class path. gwt-servlet-deps.jar contains them if you need it. -- 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/-/ef-DrCiX0nMJ. 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.
Re: GWT 2.4 AutoBean example not working
That worked. Thanks! We should get that added to the wiki documentation some how... On Monday, July 16, 2012 2:38:42 AM UTC-4, Thomas Broyer wrote: You need org.json classes in your class path. gwt-servlet-deps.jar contains them if you need it. -- 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/-/7_uKU3y_dcEJ. 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.
Re: GWT 2.4 AutoBean example not working
On Monday, July 16, 2012 12:53:47 PM UTC+2, brent...@gmail.com wrote: That worked. Thanks! We should get that added to the wiki documentation some how... It should no longer be a problem with 2.5.0-rc1, as org.json classes are now bundled into gwt-dev.jar. -- 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/-/rmjivOpBuJMJ. 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.
[gwt-contrib] Re: Using RequestFactory, AutoBean equality compares stableId proxyClass, which will NPE if stableId is not set.
On Thursday, July 12, 2012 2:56:06 AM UTC+2, Eric Friesen wrote: This occurs in the ValueProxyCategory: http://code.google.com/searchframe#T04cSGC7sWI/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/ValueProxyCategory.javaq=ValueProxyCategory%20package:google-web-toolkit%5C.googlecode%5C.coml=42 It's causing our project to not be able to compare our AutoBean objects returned to us from RequestFactory requests. Would a change to check whether the AutoBeans have stable ids in the first place before trying to compare their proxy classes be acceptable? Or am I missing something in the big picture here and it's a bad idea. As far as I can tell it's an optimization to fail early without having to do a deep equals and this change would be alright. If this sounds reasonable I'll put in a fix for review. The thing is: stableId shouldn't ever be 'null', that'd be a bug. Maybe you create a ValueProxy AutoBean without using RequestContext#create(); that's not supported, that'd be a bug in your code. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Using RequestFactory, AutoBean equality compares stableId proxyClass, which will NPE if stableId is not set.
Interesting. I'm using regular RequestFactory calls to the server to get these objects. In particular my example where this is happening is: Call a server method to get a List of objects of type A. Get two objects from the list (or the same object twice). and call a.equals(b); So I suppose there's a way for RequestFactory to create objects without StableIds that I need to look into. Thanks! -E On Thursday, July 12, 2012 2:19:51 AM UTC-7, Thomas Broyer wrote: On Thursday, July 12, 2012 2:56:06 AM UTC+2, Eric Friesen wrote: This occurs in the ValueProxyCategory: http://code.google.com/searchframe#T04cSGC7sWI/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/ValueProxyCategory.javaq=ValueProxyCategory%20package:google-web-toolkit%5C.googlecode%5C.coml=42 It's causing our project to not be able to compare our AutoBean objects returned to us from RequestFactory requests. Would a change to check whether the AutoBeans have stable ids in the first place before trying to compare their proxy classes be acceptable? Or am I missing something in the big picture here and it's a bad idea. As far as I can tell it's an optimization to fail early without having to do a deep equals and this change would be alright. If this sounds reasonable I'll put in a fix for review. The thing is: stableId shouldn't ever be 'null', that'd be a bug. Maybe you create a ValueProxy AutoBean without using RequestContext#create(); that's not supported, that'd be a bug in your code. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
Re: Hierachy of autobean for state serialization
While I agree that RequestFactory is the ultimate solution, we don't always have the luxury of selecting which server to communicate with .. I am bound to using JSON-RPC as our server end is in .NET .. I faced the same polymorphism solution, and solved it by creating a mondo interface .. I created one interface that extends all subclasses of the base type .. Our process is somewhat convoluted ... using soap to import all possible models, params, and results .. Then running a script to sanitize the data and create autobean compatible interfaces out of this data.. My issue was serializing one param that was a generic filter .. creating this mondo interface lets me set only the values I want yet allows for every field I've set to be serialized.. cheers On Friday, 3 June 2011 14:55:39 UTC-4, Derek wrote: Thanks for posting this, Panam. I was just starting to consider using AutoBean with LocalStorage, since storing a JSON string seems like the best solution than rolling my own custom serializer. I haven't gotten too far into it beyond some simple test cases. For 2), I seem to recall seeing that polymorphism for AutoBean is an eventual goal for the GWT group, but 2.3 doesn't support it. For 1), my thoughts would either be on using AutoBeanVisitor (which can only see things already explicitly added, so probably not) or a generator (which might trip up AutoBean's generator), but I haven't tried either in the way you describe, so maybe I'm wrong. I think the official way is to have an interface for each subclass in your AutoBeanFactory, so for example: public interface Base { getName() / setName() } public class BaseImpl implements Base { ... } public interface Color extends Base { getColor() / setColor() } public class ColorImpl extends BaseImpl implements Color { ... } public interface Serializer extends AutoBeanFactory { AutoBeanBase wrap(Base wrap); AutoBeanColor wrap(Color wrap); } That works if you only have a small handful of subclasses, but it gets progressively worse the more you add. On Jun 2, 3:48 am, Panam pandem...@googlemail.com wrote: Hm, I am just looking for a way to enocde and persist (webstore) state (some POJO properties) on the client. I have difficulties to see see how the RequestFactory will help me here as my intention is that it is for client server communication. However, it ought to be possible (at least, it has to do serialization to put the data on the wire). As I understand autobeans, they are that part of the bindery framework that is used for this purpose (amongst all by the request factory itself). That's why I am trying to use them here. Regards, panam -- 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/-/2xL-2JthgdQJ. 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.
[gwt-contrib] Using RequestFactory, AutoBean equality compares stableId proxyClass, which will NPE if stableId is not set.
This occurs in the ValueProxyCategory: http://code.google.com/searchframe#T04cSGC7sWI/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/ValueProxyCategory.javaq=ValueProxyCategory%20package:google-web-toolkit%5C.googlecode%5C.coml=42 It's causing our project to not be able to compare our AutoBean objects returned to us from RequestFactory requests. Would a change to check whether the AutoBeans have stable ids in the first place before trying to compare their proxy classes be acceptable? Or am I missing something in the big picture here and it's a bad idea. As far as I can tell it's an optimization to fail early without having to do a deep equals and this change would be alright. If this sounds reasonable I'll put in a fix for review. Thanks! -E -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
How to convert an object that contains Listsomething to json using AutoBean
Does anyone have successfully convert List of objects to JSON by using AutoBean? it seems it's giving me error like null cannot be in getter method.. anyone has an simple example to share? thx. -- 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/-/bOePgj-xMBYJ. 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.
Re: How to convert an object that contains Listsomething to json using AutoBean
Code, error? We need more than that to help you. Did you follow the AutoBean tutorialhttp://code.google.com/p/google-web-toolkit/wiki/AutoBean ? Sincerely, Joseph -- 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/-/l9r-BOXOa0UJ. 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.
[gwt-contrib] Re: Issue 6331: Let AutoBean accept numbers for dates and longs (issue1601805)
LGTM and I'll be committing this soon. http://gwt-code-reviews.appspot.com/1601805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
Re: RequestFactory/Editor AutoBean has been frozen error
On Monday, April 23, 2012 10:29:35 AM UTC+2, Tiago wrote: Hello Brandon, My problem isn't always autobean is frozen, it changes, but the summary is that I cannot resubmit a proxy after a server error (like an unique constraint violation, for example) that ends up calling Receiver.onFailure(). The error I tend to get is DeadEntityException. All I want is to be able to resubmit a proxy after a problem in the server. Recreate it is not an option because the user has already modified it, and I want to preserve the modifications. That's probably a common use case, I can't be the only one struggling with it, can I? In RequestFactory's design, onFailure is really an exception, and should never happen: errors should be conveyed as special return values. That doesn't quite change your issue here, as the proxy wouldn't be reusable either: that's because, again, RF has been designed with the idea that things shouldn't go wrong. For instance, unique constraint violations are not natural for (most / non-technical) users. Moreover, those kind of conditions should probably be detected as ConstraintVIolations so the user can fix the proxy and resubmit his request. -- 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/-/5gujztakBUcJ. 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.
Re: RequestFactory/Editor AutoBean has been frozen error
Hello Thomas, On Monday, April 23, 2012 11:49:54 AM UTC+2, Thomas Broyer wrote: In RequestFactory's design, onFailure is really an exception, and should never happen: errors should be conveyed as special return values. That doesn't quite change your issue here, as the proxy wouldn't be reusable either: that's because, again, RF has been designed with the idea that things shouldn't go wrong. For instance, unique constraint violations are not natural for (most / non-technical) users. Moreover, those kind of conditions should probably be detected as ConstraintVIolations so the user can fix the proxy and resubmit his request. Could you help me a bit more by pointing to an example of what do you mean by detected as ConstraintViolation? I have a situation where the user must attribute a reference value to an entity, and this value must be unique. I can only know if it's unique after my service is called and either I attempt an insert and treat the exception, or if I make a previous select before the insert (very low risk of concurrence issues for my case, I think I could safely ignore such risk). In either case, the request is already gone and the service has already been called. From what I understood by reading the previous thread I linked to, it is already too late to reuse the proxy. By the way, I was not using onFailure as you say it should be used. I was using it for general business failures. We've even implemented a generic Receiver to deal with that. Not challenging what you say, but it really doesn't look like RF was built with the idea that errors should be treated in the return value... the return value most of the time is a proxy (or Collection of proxies) to an entity used in the back-end. Entities are not supposed to have request-specific error data. Basically, to operate like that, I would need different DTOs for every request, and proxy these DTOs, which would contain the needed entities plus error information. Is that how RF is supposed to be used? Thank you, Tiago. -- 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/-/tsM6lHU0uvQJ. 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.
Re: RequestFactory/Editor AutoBean has been frozen error
On Monday, April 23, 2012 2:57:09 PM UTC+2, Tiago wrote: Hello Thomas, On Monday, April 23, 2012 11:49:54 AM UTC+2, Thomas Broyer wrote: In RequestFactory's design, onFailure is really an exception, and should never happen: errors should be conveyed as special return values. That doesn't quite change your issue here, as the proxy wouldn't be reusable either: that's because, again, RF has been designed with the idea that things shouldn't go wrong. For instance, unique constraint violations are not natural for (most / non-technical) users. Moreover, those kind of conditions should probably be detected as ConstraintVIolations so the user can fix the proxy and resubmit his request. Could you help me a bit more by pointing to an example of what do you mean by detected as ConstraintViolation? I have a situation where the user must attribute a reference value to an entity, and this value must be unique. I can only know if it's unique after my service is called and either I attempt an insert and treat the exception, or if I make a previous select before the insert (very low risk of concurrence issues for my case, I think I could safely ignore such risk). In either case, the request is already gone and the service has already been called. From what I understood by reading the previous thread I linked to, it is already too late to reuse the proxy. You can use a custom JSR303 validator that does the select and the check; so that in case of a unique constraint violation, a ConstraintViolation would be sent back to the client (and in this case, the proxy is unfrozen so it can be fixed before firing the RequestContext again). By the way, I was not using onFailure as you say it should be used. I was using it for general business failures. We've even implemented a generic Receiver to deal with that. Not challenging what you say, but it really doesn't look like RF was built with the idea that errors should be treated in the return value... the return value most of the time is a proxy (or Collection of proxies) to an entity used in the back-end. Entities are not supposed to have request-specific error data. Basically, to operate like that, I would need different DTOs for every request, and proxy these DTOs, which would contain the needed entities plus error information. Is that how RF is supposed to be used? When your service method has error paths, yes; but the main idea is that there should as few as possible. -- 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/-/CBDzv45Cy4AJ. 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.
Re: RequestFactory/Editor AutoBean has been frozen error
On Monday, April 23, 2012 4:21:50 PM UTC+2, Thomas Broyer wrote: You can use a custom JSR303 validator that does the select and the check; so that in case of a unique constraint violation, a ConstraintViolation would be sent back to the client (and in this case, the proxy is unfrozen so it can be fixed before firing the RequestContext again). Interesting. I'll look into it. Do you realize, though, that by doing this you will: - Make at least one DB access more than what's strictly necessary. - Potentially run concurrence risks. If the risks are considerable, you may need pessimistic locks... I feel uneasy with the potential overheads you add just due to the architecture. But, well, I guess until issue #5794 is not included, and if such overheads are not a big issue (and I bet they won't be for most people), that's probably the way to go. When your service method has error paths, yes; but the main idea is that there should as few as possible. If you manage to filter everything via validators, then yeah, probably you won't have much more error paths to deal with. I wasn't using validators for anything needing DB access though. Thank you again for your answers Thomas. Your help is much appreciated. Best regards, Tiago. -- 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/-/gBETWuHuMRAJ. 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.
Re: AutoBean
Hi, Create the factory instance at the starting of the method similar to below public void listtest(){ MyFactory fact = GWT.*create*(MyFactory.*class*); ... } Use the below code *points.add(fact.point(o).as());* * * *points.add(fact.point(n).as());* instead of *points.add(o);* *points.add(n);* Thanks *Govindan* On Wed, Apr 11, 2012 at 7:40 PM, italobb ital...@gmail.com wrote: I'm experiencing the same problem. Have you solved it? How? On Monday, October 17, 2011 4:38:53 PM UTC-2, Aidan OK wrote: Is anyone using AutoBean in a JRE environment successfully? When trying a very simple test I get a NPE when I try to use AutoBeanCodex.encode(** myAutoBean) My Bean interfaces look like this: public static interface Point { Long getX(); Long getY(); void setX(Long x); void setY(Long y); } public static interface PointList { String getName(); void setName(String name); ListPoint getPoints(); void setPoints(ListPoint points); } I'll omit the implementations for brevity but they are just standard objects with some getters/setters. My bean factory: public static interface MyFactory extends AutoBeanFactory { AutoBeanPoint point(); AutoBeanPoint point(Point instance); AutoBeanPointList pointList(); AutoBeanPointList pointList(PointList instance); } I can create the AutoBeanPoint , AutoBeanPointList ok from my factory. I can use AutoBeanCodex to encode a Point, and it emits the correct Json. If I try an encode a PointList object however, AutoBeanCodex.encode() throws a NPE. Its certainly the ListPoint which is causing it, as if I remove it, it works ok. And If I make PointList contain a few direct references to Point beans, that also works (so if PointList has 'Point getPointA()', 'Point getPointB()', it does encode everything correctly.) Am I missing something obvious? The code to test is below. public void listtest() { Point o = new PointImpl(); Point n = new PointImpl(); PointList plist = new PointListImpl(); ListPoint points = new ArrayListPoint(); o.setX(20L); o.setY(30L); n.setY(60L); n.setX(80L); points.add(o); points.add(n); plist.setName(OH); plist.setPoints(points); MyFactory fact = AutoBeanFactorySource.create(**MyFactory.class); AutoBeanPointList alist = fact.pointList(plist); System.out.println(Splittable Payload: + AutoBeanCodex.encode(alist).* *getPayload()); } java.lang.NullPointerException at com.google.web.bindery.**autobean.shared.impl.** AutoBeanCodexImpl.doEncode(**AutoBeanCodexImpl.java:558) at com.google.web.bindery.**autobean.shared.impl.** AutoBeanCodexImpl$ObjectCoder.**encode(AutoBeanCodexImpl.java:**321) at com.google.web.bindery.**autobean.shared.impl.**AutoBeanCodexImpl$** CollectionCoder.encode(**AutoBeanCodexImpl.java:163) at com.google.web.bindery.**autobean.shared.impl.**AutoBeanCodexImpl$** PropertyGetter.encodeProperty(**AutoBeanCodexImpl.java:413) at com.google.web.bindery.**autobean.shared.impl.**AutoBeanCodexImpl$** PropertyGetter.**visitReferenceProperty(**AutoBeanCodexImpl.java:389) at com.google.web.bindery.**autobean.shared.**AutoBeanVisitor.** visitCollectionProperty(**AutoBeanVisitor.java:229) at com.google.web.bindery.**autobean.vm.impl.**ProxyAutoBean.** traverseProperties(**ProxyAutoBean.java:300) at com.google.web.bindery.**autobean.shared.impl.** AbstractAutoBean.traverse(**AbstractAutoBean.java:166) at com.google.web.bindery.**autobean.shared.impl.** AbstractAutoBean.accept(**AbstractAutoBean.java:101) at com.google.web.bindery.**autobean.shared.impl.** AutoBeanCodexImpl.doEncode(**AutoBeanCodexImpl.java:558) at com.google.web.bindery.**autobean.shared.AutoBeanCodex.** encode(AutoBeanCodex.java:83) at temp.AutoBeanListTest.**listtest(AutoBeanListTest.**java:111) at sun.reflect.**NativeMethodAccessorImpl.**invoke0(Native Method) at sun.reflect.**NativeMethodAccessorImpl.**invoke(Unknown Source) at sun.reflect.**DelegatingMethodAccessorImpl.**invoke(Unknown Source) at java.lang.reflect.Method.**invoke(Unknown Source) at org.junit.runners.model.**FrameworkMethod$1.**runReflectiveCall(** FrameworkMethod.java:44) at org.junit.internal.runners.**model.ReflectiveCallable.run(** ReflectiveCallable.java:15) at org.junit.runners.model.**FrameworkMethod.**invokeExplosively(** FrameworkMethod.java:41) at org.junit.internal.runners.**statements.InvokeMethod.** evaluate(InvokeMethod.java:20) at org.junit.runners.**ParentRunner.runLeaf(**ParentRunner.java:263) at org.junit.runners.**BlockJUnit4ClassRunner.**runChild(** BlockJUnit4ClassRunner.java:**69) at org.junit.runners.**BlockJUnit4ClassRunner.**runChild(** BlockJUnit4ClassRunner.java:**48) at org.junit.runners.**ParentRunner$3.run(**ParentRunner.java:231) at org.junit.runners.**ParentRunner$1.schedule(**ParentRunner.java:60) at org.junit.runners.**ParentRunner.runChildren(**ParentRunner.java:229) at org.junit.runners.**ParentRunner.access$000(**ParentRunner.java:50
Re: AutoBean
Ta for posting the work-around.. I missed the original reply the my original thread (subscribed too many lists!) but for reference, there is a bug entry in the issues list for this: http://code.google.com/p/google-web-toolkit/issues/detail?id=6904 I'll add a comment with this extra info. On Fri, Apr 20, 2012 at 3:28 PM, govindan govindan gowindone...@gmail.comwrote: Hi, Create the factory instance at the starting of the method similar to below public void listtest(){ MyFactory fact = GWT.*create*(MyFactory.*class*); ... } Use the below code *points.add(fact.point(o).as());* * * *points.add(fact.point(n).as());* instead of *points.add(o);* *points.add(n);* Thanks *Govindan* On Wed, Apr 11, 2012 at 7:40 PM, italobb ital...@gmail.com wrote: I'm experiencing the same problem. Have you solved it? How? On Monday, October 17, 2011 4:38:53 PM UTC-2, Aidan OK wrote: Is anyone using AutoBean in a JRE environment successfully? When trying a very simple test I get a NPE when I try to use AutoBeanCodex.encode(** myAutoBean) My Bean interfaces look like this: public static interface Point { Long getX(); Long getY(); void setX(Long x); void setY(Long y); } public static interface PointList { String getName(); void setName(String name); ListPoint getPoints(); void setPoints(ListPoint points); } I'll omit the implementations for brevity but they are just standard objects with some getters/setters. My bean factory: public static interface MyFactory extends AutoBeanFactory { AutoBeanPoint point(); AutoBeanPoint point(Point instance); AutoBeanPointList pointList(); AutoBeanPointList pointList(PointList instance); } I can create the AutoBeanPoint , AutoBeanPointList ok from my factory. I can use AutoBeanCodex to encode a Point, and it emits the correct Json. If I try an encode a PointList object however, AutoBeanCodex.encode() throws a NPE. Its certainly the ListPoint which is causing it, as if I remove it, it works ok. And If I make PointList contain a few direct references to Point beans, that also works (so if PointList has 'Point getPointA()', 'Point getPointB()', it does encode everything correctly.) Am I missing something obvious? The code to test is below. public void listtest() { Point o = new PointImpl(); Point n = new PointImpl(); PointList plist = new PointListImpl(); ListPoint points = new ArrayListPoint(); o.setX(20L); o.setY(30L); n.setY(60L); n.setX(80L); points.add(o); points.add(n); plist.setName(OH); plist.setPoints(points); MyFactory fact = AutoBeanFactorySource.create(**MyFactory.class); AutoBeanPointList alist = fact.pointList(plist); System.out.println(Splittable Payload: + AutoBeanCodex.encode(alist). **getPayload()); } java.lang.NullPointerException at com.google.web.bindery.**autobean.shared.impl.** AutoBeanCodexImpl.doEncode(**AutoBeanCodexImpl.java:558) at com.google.web.bindery.**autobean.shared.impl.** AutoBeanCodexImpl$ObjectCoder.**encode(AutoBeanCodexImpl.java:**321) at com.google.web.bindery.**autobean.shared.impl.**AutoBeanCodexImpl$** CollectionCoder.encode(**AutoBeanCodexImpl.java:163) at com.google.web.bindery.**autobean.shared.impl.**AutoBeanCodexImpl$** PropertyGetter.encodeProperty(**AutoBeanCodexImpl.java:413) at com.google.web.bindery.**autobean.shared.impl.**AutoBeanCodexImpl$** PropertyGetter.**visitReferenceProperty(**AutoBeanCodexImpl.java:389) at com.google.web.bindery.**autobean.shared.**AutoBeanVisitor.** visitCollectionProperty(**AutoBeanVisitor.java:229) at com.google.web.bindery.**autobean.vm.impl.**ProxyAutoBean.** traverseProperties(**ProxyAutoBean.java:300) at com.google.web.bindery.**autobean.shared.impl.** AbstractAutoBean.traverse(**AbstractAutoBean.java:166) at com.google.web.bindery.**autobean.shared.impl.** AbstractAutoBean.accept(**AbstractAutoBean.java:101) at com.google.web.bindery.**autobean.shared.impl.** AutoBeanCodexImpl.doEncode(**AutoBeanCodexImpl.java:558) at com.google.web.bindery.**autobean.shared.AutoBeanCodex.** encode(AutoBeanCodex.java:83) at temp.AutoBeanListTest.**listtest(AutoBeanListTest.**java:111) at sun.reflect.**NativeMethodAccessorImpl.**invoke0(Native Method) at sun.reflect.**NativeMethodAccessorImpl.**invoke(Unknown Source) at sun.reflect.**DelegatingMethodAccessorImpl.**invoke(Unknown Source) at java.lang.reflect.Method.**invoke(Unknown Source) at org.junit.runners.model.**FrameworkMethod$1.**runReflectiveCall(** FrameworkMethod.java:44) at org.junit.internal.runners.**model.ReflectiveCallable.run(** ReflectiveCallable.java:15) at org.junit.runners.model.**FrameworkMethod.**invokeExplosively(** FrameworkMethod.java:41) at org.junit.internal.runners.**statements.InvokeMethod.** evaluate(InvokeMethod.java:20) at org.junit.runners.**ParentRunner.runLeaf(**ParentRunner.java:263) at org.junit.runners.**BlockJUnit4ClassRunner.**runChild(** BlockJUnit4ClassRunner.java:**69
Re: RequestFactory/Editor AutoBean has been frozen error
I've has those too. I'm not sure there is enough source to diagnose. Do you have a list in your bean? 1. how do you init your driver? 2. do you have list that is null from server. 3. do you have a list that is null when you start then you add to list then edit it again. always init a list as empty list. 4. how are you creating your bean? then edit it? 5. are you using the same context for bean creation for lists that are children in the bean? I get more frozen errors with lists and how I init them, I always use the same context. Hope that helps, Brandon Donnelson http://c.gwt-examples.com -- 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/-/eF1dEZn0OdQJ. 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.
Re: AutoBean
I'm experiencing the same problem. Have you solved it? How? On Monday, October 17, 2011 4:38:53 PM UTC-2, Aidan OK wrote: Is anyone using AutoBean in a JRE environment successfully? When trying a very simple test I get a NPE when I try to use AutoBeanCodex.encode(myAutoBean) My Bean interfaces look like this: public static interface Point { Long getX(); Long getY(); void setX(Long x); void setY(Long y); } public static interface PointList { String getName(); void setName(String name); ListPoint getPoints(); void setPoints(ListPoint points); } I'll omit the implementations for brevity but they are just standard objects with some getters/setters. My bean factory: public static interface MyFactory extends AutoBeanFactory { AutoBeanPoint point(); AutoBeanPoint point(Point instance); AutoBeanPointList pointList(); AutoBeanPointList pointList(PointList instance); } I can create the AutoBeanPoint , AutoBeanPointList ok from my factory. I can use AutoBeanCodex to encode a Point, and it emits the correct Json. If I try an encode a PointList object however, AutoBeanCodex.encode() throws a NPE. Its certainly the ListPoint which is causing it, as if I remove it, it works ok. And If I make PointList contain a few direct references to Point beans, that also works (so if PointList has 'Point getPointA()', 'Point getPointB()', it does encode everything correctly.) Am I missing something obvious? The code to test is below. public void listtest() { Point o = new PointImpl(); Point n = new PointImpl(); PointList plist = new PointListImpl(); ListPoint points = new ArrayListPoint(); o.setX(20L); o.setY(30L); n.setY(60L); n.setX(80L); points.add(o); points.add(n); plist.setName(OH); plist.setPoints(points); MyFactory fact = AutoBeanFactorySource.create(MyFactory.class); AutoBeanPointList alist = fact.pointList(plist); System.out.println(Splittable Payload: + AutoBeanCodex.encode(alist).getPayload()); } java.lang.NullPointerException at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doEncode(AutoBeanCodexImpl.java:558) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$ObjectCoder.encode(AutoBeanCodexImpl.java:321) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$CollectionCoder.encode(AutoBeanCodexImpl.java:163) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyGetter.encodeProperty(AutoBeanCodexImpl.java:413) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyGetter.visitReferenceProperty(AutoBeanCodexImpl.java:389) at com.google.web.bindery.autobean.shared.AutoBeanVisitor.visitCollectionProperty(AutoBeanVisitor.java:229) at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:300) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doEncode(AutoBeanCodexImpl.java:558) at com.google.web.bindery.autobean.shared.AutoBeanCodex.encode(AutoBeanCodex.java:83) at temp.AutoBeanListTest.listtest(AutoBeanListTest.java:111) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:292) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683
Re: RequestFactory/Editor AutoBean has been frozen error
Hello all, I tried to reply to the message below in its own thread (here: http://groups.google.com/group/google-web-toolkit/browse_thread/thread/4309e1e60f2cb8d8?pli=1 ), but I was getting an error at every attempt, so I decided to open a new topic with the same title. It seems this useful workaround doesn't work anymore. I get a ClassCastException when I try it. My RequestContext implementation is casted to AbstractRequestContext$State. I can't find a way to access the state of a RequestContext in order to attribute the new one to the old AutoBean. The attribute is private. It almost seems somebody wanted to prevent this hack from being possible... Is there any alternative now, besides manually copying each property of each proxy? Thank you for any help, Tiago. On Feb 22 2011, 9:41 pm, Scott Olcott scottolc...@gmail.com wrote: Thomas, You are correct in understanding my issue. I tried calling AutoBean.clone(), but is fails with a Cannot clone wrapped bean error. I was however able to resubmit the proxy successfully using the following: AutoBeanTest autoBean = AutoBeanUtils.getAutoBean(test); autoBean.setFrozen(false); requestContext = requestFactory.testRequest(); autoBean.setTag(requestContext, requestContext); driver.edit(test, requestContext); calling autoBean.setTag(requestContext, requestContext) is needed to avoid a Attempting to edit an EntityProxy previously edited by another RequestContext error. I know it's a hack but it's the only thing I can get to work other than copying the proxy into a new proxy property by property. -- Tiago Rinck Caveden -- 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-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.
Re: AutoBean encoding on server-side with overriden method causes duplicate key
See http://code.google.com/p/google-web-toolkit/issues/detail?id=5926 I had the issue with RequestFactory proxies but I suppose it applies to all autobeans (as on of the culprits was ProxyAutoBean). I hope it'll make it into the upcoming GWT 2.5 release. On Thursday, April 12, 2012 1:02:37 AM UTC+2, kjordan wrote: I'm trying to use the AutoBean encoding so I can pass and parse types over a websocket connection I have. However, there seem to be some bugs with trying to encode AutoBeans on the server side. I had a structure like public interface Foo { } public interface Bar { } public interface AT extends Foo { T getFoo(); void setFoo(T foo); } public interface B extends ABar { @Override Bar getFoo(); @Override void setFoo(Bar foo); } but that ended up getting an exception when the setter is called: java.lang.NullPointerException at com.google.web.bindery.autobean.vm.impl.MethodPropertyContext.traverse(MethodPropertyContext.java:102) at com.google.web.bindery.autobean.vm.impl.MethodPropertyContext.accept(MethodPropertyContext.java:75) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyCoderCreator.maybeCreateCoder(AutoBeanCodexImpl.java:353) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyCoderCreator.visitReferenceProperty(AutoBeanCodexImpl.java:341) at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:324) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doCoderFor(AutoBeanCodexImpl.java:521) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.setProperty(AbstractAutoBean.java:276) at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.setProperty(ProxyAutoBean.java:253) at com.google.web.bindery.autobean.vm.impl.BeanMethod$3.invoke(BeanMethod.java:103) at com.google.web.bindery.autobean.vm.impl.SimpleBeanHandler.invoke(SimpleBeanHandler.java:43) So I switched it to: public interface A { Foo getFoo(); } public interface B extends A { @Override Bar getFoo(); @Override void setFoo(Bar foo); } but that gets me: java.lang.RuntimeException: Could not parse payload at com.google.web.bindery.autobean.vm.impl.JsonSplittable.create(JsonSplittable.java:73) at com.google.web.bindery.autobean.shared.impl.StringQuoter.split(StringQuoter.java:73) at com.google.web.bindery.autobean.shared.AutoBeanCodex.encode(AutoBeanCodex.java:84) Caused by: org.json.JSONException: Duplicate key foo at org.json.JSONObject.putOnce(JSONObject.java:1076) at org.json.JSONObject.init(JSONObject.java:205) at org.json.JSONObject.init(JSONObject.java:402) at com.google.web.bindery.autobean.vm.impl.JsonSplittable.create(JsonSplittable.java:47) ... 12 more I'm going to try it with just the super interfaces and no overriding, but I'm not sure the client is going to reconstruct foo with the proper type. I can maybe understand the first one not working since I know RequestFactory and such are always picky about the use of generics also and I've learned to be careful about that. But the second one seems to just be it not paying attention to the override which seems like a problem that should be fixed. On the server-side, I'm using AutoBeanFactorySource to create the AutoBeanFactory, which I see is supposedly experimental. I'm then using AutoBeanCodex to do the encoding. Has anyone had success encoding AutoBeans on the server-side? -- 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/-/dJ9LES1-5F4J. 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.
AutoBean encoding on server-side with overriden method causes duplicate key
I'm trying to use the AutoBean encoding so I can pass and parse types over a websocket connection I have. However, there seem to be some bugs with trying to encode AutoBeans on the server side. I had a structure like public interface Foo { } public interface Bar { } public interface AT extends Foo { T getFoo(); void setFoo(T foo); } public interface B extends ABar { @Override Bar getFoo(); @Override void setFoo(Bar foo); } but that ended up getting an exception when the setter is called: java.lang.NullPointerException at com.google.web.bindery.autobean.vm.impl.MethodPropertyContext.traverse(MethodPropertyContext.java:102) at com.google.web.bindery.autobean.vm.impl.MethodPropertyContext.accept(MethodPropertyContext.java:75) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyCoderCreator.maybeCreateCoder(AutoBeanCodexImpl.java:353) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyCoderCreator.visitReferenceProperty(AutoBeanCodexImpl.java:341) at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:324) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101) at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doCoderFor(AutoBeanCodexImpl.java:521) at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.setProperty(AbstractAutoBean.java:276) at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.setProperty(ProxyAutoBean.java:253) at com.google.web.bindery.autobean.vm.impl.BeanMethod$3.invoke(BeanMethod.java:103) at com.google.web.bindery.autobean.vm.impl.SimpleBeanHandler.invoke(SimpleBeanHandler.java:43) So I switched it to: public interface A { Foo getFoo(); } public interface B extends A { @Override Bar getFoo(); @Override void setFoo(Bar foo); } but that gets me: java.lang.RuntimeException: Could not parse payload at com.google.web.bindery.autobean.vm.impl.JsonSplittable.create(JsonSplittable.java:73) at com.google.web.bindery.autobean.shared.impl.StringQuoter.split(StringQuoter.java:73) at com.google.web.bindery.autobean.shared.AutoBeanCodex.encode(AutoBeanCodex.java:84) Caused by: org.json.JSONException: Duplicate key foo at org.json.JSONObject.putOnce(JSONObject.java:1076) at org.json.JSONObject.init(JSONObject.java:205) at org.json.JSONObject.init(JSONObject.java:402) at com.google.web.bindery.autobean.vm.impl.JsonSplittable.create(JsonSplittable.java:47) ... 12 more I'm going to try it with just the super interfaces and no overriding, but I'm not sure the client is going to reconstruct foo with the proper type. I can maybe understand the first one not working since I know RequestFactory and such are always picky about the use of generics also and I've learned to be careful about that. But the second one seems to just be it not paying attention to the override which seems like a problem that should be fixed. On the server-side, I'm using AutoBeanFactorySource to create the AutoBeanFactory, which I see is supposedly experimental. I'm then using AutoBeanCodex to do the encoding. Has anyone had success encoding AutoBeans on the server-side? -- 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/-/gzUTr7dW-CkJ. 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.
[gwt-contrib] Re: Issue 6331: Let AutoBean accept numbers for dates and longs (issue1601805)
http://gwt-code-reviews.appspot.com/1601805/diff/11002/user/src/com/google/web/bindery/autobean/shared/ValueCodex.java File user/src/com/google/web/bindery/autobean/shared/ValueCodex.java (right): http://gwt-code-reviews.appspot.com/1601805/diff/11002/user/src/com/google/web/bindery/autobean/shared/ValueCodex.java#newcode41 user/src/com/google/web/bindery/autobean/shared/ValueCodex.java:41: if (value.isNumber()) { Although strictly speaking this is an improvement, I think users will be confused by a partial implementation. If we support converting JSON numbers to BigDecimals at all, as a naive user I'd expect to be able to handle BigDecimal's entire range, and not be limited to a JavaScript number's range due to an internal limitation. (If a smaller range is okay, I wouldn't be using a BigDecimal in the first place.) It seems like we should be able to do better than this by accessing the underlying string without converting it to a number first, so we can handle BigDecimal's entire range instead of just the JavaScript range for a number? But I tried drilling down and I'm not following how JSON parsing works. It looks like a project for a different CL. Maybe best to revert this and start another CL if you want to work on BigDecimal/BigInteger. http://gwt-code-reviews.appspot.com/1601805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Issue 6331: Let AutoBean accept numbers for dates and longs (issue1601805)
http://gwt-code-reviews.appspot.com/1601805/diff/11002/user/src/com/google/web/bindery/autobean/shared/ValueCodex.java File user/src/com/google/web/bindery/autobean/shared/ValueCodex.java (right): http://gwt-code-reviews.appspot.com/1601805/diff/11002/user/src/com/google/web/bindery/autobean/shared/ValueCodex.java#newcode41 user/src/com/google/web/bindery/autobean/shared/ValueCodex.java:41: if (value.isNumber()) { On 2012/04/11 15:57:02, skybrian wrote: Although strictly speaking this is an improvement, I think users will be confused by a partial implementation. If we support converting JSON numbers to BigDecimals at all, as a naive user I'd expect to be able to handle BigDecimal's entire range, and not be limited to a JavaScript number's range due to an internal limitation. (If a smaller range is okay, I wouldn't be using a BigDecimal in the first place.) This is the same rationale as for accepting numbers in JSON for longs (though in that case it used to work and then there was a change that broke it). It seems like we should be able to do better than this by accessing the underlying string without converting it to a number first, so we can handle BigDecimal's entire range instead of just the JavaScript range for a number? But I tried drilling down and I'm not following how JSON parsing works. isNumber() is not converting to number. Here's how things work in AutoBeans: 1. received JSON data is parsed into a Splittable. This will use JsonUtils.safeEval on GWT-client side (will use the browser's native JSON.parse if available, and fallback to eval() with some regexp sanity checks), returning a JsoSplittable implementation (i.e. a JS object equivalent to the serialized JSON), and org.json in a plain VM, returning a JsonSplittable implementation (i.e. backed by a JSONObject). When encountering numbers in the JSON, the JsonSplittable calls doubleValue() on them; in web mode though, numbers in the JSON have to be parsable into JS numbers, or JSON.parse will throw. 2. then Splittable is wrapped by AutoBeanCodex into an AutoBean. Note that you can also get a Splittable out of an AutoBean, or manually constructing it, so a Splittable does not necessarily comes from a serialized JSON message (though most of the time that'll be the case) 3. when accessing a property of the AutoBean, the value is read out of the Splittable (as another Splittable) and reified (and cached in a Map within the AutoBean): using AutoBeanCodex for other autobeans, or ValueCodex to decode value-type properties (this is where we are here) So, if you receive the following JSON: {foo: 123} the Splittable for 123 (returned by get(foo) on the Splittable for the object) will return true for isNumber() and false for isString(); and it will return the double 123.0 for asNumber() and 'null' for asString(). If you receive the following: {foo: 123} then the Splittable for 123 will return false for isNumber() and true for isString(); and will possibly throw or return null for asNumber(), and return the string 123 for asString(). There's no parsing or conversion involved at that time, these are mutually exclusive states. BigDecimal, BigInteger and Long all possibly overflowing a JS number and always encoded as strings. This was not the case in an earlier version of GWT, so you could only send values that fitted into a JS Number, i.e. java.lang.Double; and that was the breaking change when BobV fixed this to serialize to strings, but no longer accepting numerics as input. Here, we're applying Postel's law of accepting both {foo:123} and {foo:123} for those big numbers. Now imagine I used a Double, and find out I need a larger range (or better precision), so I switch to a BigDecimal. Without this CL, I can no longer parse a {foo:123} JSON (or actually, it'll give me a 'null' value for foo instead of a BigDecimal with value 123), and that JSON could have been saved in localStorage... I added the lenient parsing behavior to BigDecimal/BigInteger only for consistency with Long though, so I'm OK removing it if you prefer (Long had a breaking change at some point, but not BigInteger/BigDecimal) http://gwt-code-reviews.appspot.com/1601805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Issue 6331: Let AutoBean accept numbers for dates and longs (issue1601805)
Okay, thanks for the explanation. The thing about consistency is that there are so many things to choose from :-) Since BigDecimal / BigInteger didn't work before, I think we can wait on those. Backward compatibility when expanding the range is an issue but I'm not sure that changing types is sufficient anyway; what about data transfer in the other direction? In practice, it might be better to introduce a new field and accept either one, which is consistent with what you'd have to do when making a bigger data format change. http://gwt-code-reviews.appspot.com/1601805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Issue 6331: Let AutoBean accept numbers for dates and longs (issue1601805)
I've added similar changes to BigDecimal and BigInteger so you can have those Big* types in your autobeans/RF-proxies and accept numeric values in the JSON (allows changing from Double to BigDecimal, for instance, in an interface without the need to change the server-side code / JSON serialization). http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java File user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java (right): http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java#newcode16 user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java:16: public class ValueCodexBenchmark extends Benchmark { On 2012/04/05 20:34:10, skybrian wrote: javadoc: could you explain what you're benchmarking? Also, maybe add a link to your spreadsheet. Done. http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java File user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java (right): http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java#newcode216 user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java:216: Date now = new Date(); On 2012/04/05 20:34:10, skybrian wrote: Using the current date in a test isn't a great choice - at least you'd want to try various dates for the next 10 years or so. Maybe try the years 1900 and 2100. Done. http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java#newcode237 user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java:237: AutoBeanHasLong decodedBean = AutoBeanCodex.decode(f, HasLong.class, {\long\: 42}); On 2012/04/05 20:34:10, skybrian wrote: Let's try a wider range. I expect it breaks for Long.MAX_VALUE and Long.MIN_VALUE. Done. Added Long.MIN_VALUE+1 (there's an issue with MIN_VALUE, see issue 7308) and Long.MAX_VALUE in testLong; and JavaScript's min/max values for numbers and dates in testDecodeLongFromNumericValue and testDate/testDecodeDateFromNumericTimestamp. http://gwt-code-reviews.appspot.com/1601805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Issue 6331: Let AutoBean accept numbers for dates and longs (issue1601805)
Ping. Brian, can you take a final look at this? http://gwt-code-reviews.appspot.com/1601805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Issue 6331: Let AutoBean accept numbers for dates and longs (issue1601805)
http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/src/com/google/web/bindery/autobean/shared/ValueCodex.java File user/src/com/google/web/bindery/autobean/shared/ValueCodex.java (right): http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/src/com/google/web/bindery/autobean/shared/ValueCodex.java#newcode107 user/src/com/google/web/bindery/autobean/shared/ValueCodex.java:107: return new Date((long) value.asNumber()); Since asNumber() returns a double, not a long, I expect this will lose precision once we are above 2^53. (What's that as a date, anyway?) http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/src/com/google/web/bindery/autobean/shared/ValueCodex.java#newcode170 user/src/com/google/web/bindery/autobean/shared/ValueCodex.java:170: return Long.valueOf((long) value.asNumber()); I expect this breaks once we get above 2^53? http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java File user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java (right): http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java#newcode16 user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java:16: public class ValueCodexBenchmark extends Benchmark { javadoc: could you explain what you're benchmarking? Also, maybe add a link to your spreadsheet. http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java#newcode45 user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java:45: public void testEncode() { Empty test... not sure what's going on here. http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java File user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java (right): http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java#newcode216 user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java:216: Date now = new Date(); Using the current date in a test isn't a great choice - at least you'd want to try various dates for the next 10 years or so. Maybe try the years 1900 and 2100. http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java#newcode237 user/test/com/google/web/bindery/autobean/shared/AutoBeanCodexTest.java:237: AutoBeanHasLong decodedBean = AutoBeanCodex.decode(f, HasLong.class, {\long\: 42}); Let's try a wider range. I expect it breaks for Long.MAX_VALUE and Long.MIN_VALUE. (And below.) http://gwt-code-reviews.appspot.com/1601805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Issue 6331: Let AutoBean accept numbers for dates and longs (issue1601805)
Hi, I think it's sufficient to test the happy path for the range that currently works and defer testing error conditions for some other time. The point is to make sure we don't accidentally regress to a smaller range and break an app that starts relying on the fix that you've added. http://gwt-code-reviews.appspot.com/1601805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Issue 6331: Let AutoBean accept numbers for dates and longs (issue1601805)
For now, AutoBeans expects that the input matches the expected format (and value ranges). The behavior seems kind of undefined when that's not the case, and not consistent between the VM and translatable implementations: * null values in some cases: dates in Java * exceptions in others: calling asNumber on a JsonSplittable without checking for isNumber can throw a NullPointerException; and Long.parseLong can throw a NumberFormatException * or even NaN: dates in JS; calling asNumber on a JsoSplittable without checking for isNumber can return NaN * or coercion to boolean: asBoolean on a JsoSplittable (note that on a JsonSplittable it could instead throw a NullPointerException) If you want this to be fixed (which would be a good thing), I'd suggest doing it in a subsequent CL addressing all of these: error cases and discrepancy between Java and JS implementations. http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/src/com/google/web/bindery/autobean/shared/ValueCodex.java File user/src/com/google/web/bindery/autobean/shared/ValueCodex.java (right): http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/src/com/google/web/bindery/autobean/shared/ValueCodex.java#newcode107 user/src/com/google/web/bindery/autobean/shared/ValueCodex.java:107: return new Date((long) value.asNumber()); On 2012/04/05 20:34:10, skybrian wrote: Since asNumber() returns a double, not a long, I expect this will lose precision once we are above 2^53. (What's that as a date, anyway?) That's theoretically right, except: * this is about decoding, so the loss of precision if any would be in Splittable, not ValueCodex. If that's a problem, then Splittable could have an added isLong/asLong (and then we'd wonder about BigInteger/BigDecimal ;-) ). If you look at JsonSplittable, it explicitly rounds values to doubles (calls doubleValue() on any Number) * this would only happen on a Java client, because a Number in JavaScript is equivalent to a double in Java; a JSON input with a numeric value outside JS Number range would raise an exception at parsing time, before we reach this code * a Date in JavaScript has an even smaller range than a Number. ECMAScript 5 says (§15.9.1.1, p. 174): ECMAScript Number values can represent all integers from –9,007,199,254,740,991 to 9,007,199,254,740,991; this range suffices to measure times to millisecond precision for any instant that is within approximately 285,616 years, either forward or backward, from 01 January, 1970 UTC. The actual range of times supported by ECMAScript Date objects is slightly smaller: exactly –100,000,000 days to 100,000,000 days measured relative to midnight at the beginning of 01 January, 1970 UTC. This gives a range of 8,640,000,000,000,000 milliseconds to either side of 01 January, 1970 UTC. If you ask me, I'd be OK to leave the behavior undefined for such out of range values, on the basis that no-one would use them anyway. The behavior is already kind of undefined in the case of a String, as it'd try to create a JsDate (when compiled in JS) from the String, which is implementation-dependent (ECMAScript 5 added a specific format inspired by ISO8601, but allows implementation to use a fallback: If the String does not conform to that format the function may fall back to any implementation-specific heuristics or implementation-specific date formats.). Furthermore, in JS, neither the JsDate.create() nor the Date(long) emulation should throw, so in case of an invalid String value, you'd get a NaN Date; in Java though, StringQuoter.tryParseDate uses Long.parseLong, ISO8601 and RFC2822 formats and then falls back to a 'null' value (which, as I said, you'd never get in JS). It might be something to fix, but that's a distinct issue (if any). http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/src/com/google/web/bindery/autobean/shared/ValueCodex.java#newcode170 user/src/com/google/web/bindery/autobean/shared/ValueCodex.java:170: return Long.valueOf((long) value.asNumber()); On 2012/04/05 20:34:10, skybrian wrote: I expect this breaks once we get above 2^53? Actually, it'll lose precision in Java (JsonSplittable would call doubleValue() on the Long parsed by org.json), and fail while parsing the JSON in JavaScript (Number cannot be represented). It's a shame that JSON (RFC 4627) doesn't define a clear and interoperable range for numbers, but I guess everyone using JSON sticks to using numeric values that can be parsed in JavaScript, i.e. falls in the java.lang.Double value space. http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java File user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java (right): http://gwt-code-reviews.appspot.com/1601805/diff/2004/user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java#newcode45 user/test/com/google/web/bindery/autobean/benchmarks/ValueCodexBenchmark.java:45: public void testEncode
Re: Create autobean as RF does it
Is there a way to a ValueProxy from the same type of object that RF would use to make a ValueProxy but outside of a web server. I'm looking to use ProxySerializer to get a string of a ValueProxy and send it via some other means to the browser where I can then serialize it back into a ValueProxy. On Friday, March 30, 2012 3:32:03 AM UTC-4, Thomas Broyer wrote: Have a look at AbstractRequestContext (particularly the processReturnOperations method; also look for calls to setTag), but basically you'll have to transport more than the AutoBean data: you'll have to send its stableId and version (have a look at SimpleRequestContext et al. for how they're computed). You'll also have to apply the BaseProxycategory, EntityProxyCategory and ValueProxyCategory to your AutoBeanFactory, and @NoWrap the EntityProxyId. Have a look at the RequestFactoryGenerator or run the DevMode or Compiler with the -gen argument to look at what's generated. All in all, it might be better (and I really mean *might*, as I have not actually looked at it in details) to use a ProxySerializer or extend the AbstractRequestContext to use RF's serialization. Search the group, there has been a similar question in the past months (and I made basically the same answer). On Thursday, March 29, 2012 12:10:09 PM UTC+2, Eugene Ivlev wrote: I have such problem: I use RF as main CRUD client-server interface, but I also use Atmosphere framework as server-push mechanism. My aim is multi-client application. All clients must receive notification about changes made by anyone. The communication looks like this: @ProxyFor(TestEntity.class) TestProxy extends EntityProxy || TestProxy obj|RF update entity--|--- RequestFactory Servlet || | || | || | || | AutoBeanTestProxy obj|--Atmosphere notification-|-| Atmosphere Servlet creates AutoBeanTestProxy | with entity to all client| || || || || || || client server But RF adds to AutoBean some kind of additional information. Therefore I can't use autobaen received from Atmosphere in next communication by RF channel. How I can create autobean as RF does it? -- 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/-/cmvim7mn3ywJ. 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.
Re: Create autobean as RF does it
Have a look at AbstractRequestContext (particularly the processReturnOperations method; also look for calls to setTag), but basically you'll have to transport more than the AutoBean data: you'll have to send its stableId and version (have a look at SimpleRequestContext et al. for how they're computed). You'll also have to apply the BaseProxycategory, EntityProxyCategory and ValueProxyCategory to your AutoBeanFactory, and @NoWrap the EntityProxyId. Have a look at the RequestFactoryGenerator or run the DevMode or Compiler with the -gen argument to look at what's generated. All in all, it might be better (and I really mean *might*, as I have not actually looked at it in details) to use a ProxySerializer or extend the AbstractRequestContext to use RF's serialization. Search the group, there has been a similar question in the past months (and I made basically the same answer). On Thursday, March 29, 2012 12:10:09 PM UTC+2, Eugene Ivlev wrote: I have such problem: I use RF as main CRUD client-server interface, but I also use Atmosphere framework as server-push mechanism. My aim is multi-client application. All clients must receive notification about changes made by anyone. The communication looks like this: @ProxyFor(TestEntity.class) TestProxy extends EntityProxy || TestProxy obj|RF update entity--|--- RequestFactory Servlet || | || | || | || | AutoBeanTestProxy obj|--Atmosphere notification-|-| Atmosphere Servlet creates AutoBeanTestProxy | with entity to all client| || || || || || || client server But RF adds to AutoBean some kind of additional information. Therefore I can't use autobaen received from Atmosphere in next communication by RF channel. How I can create autobean as RF does it? -- 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/-/XoGFX3xfzGYJ. 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.
Create autobean as RF does it
I have such problem: I use RF as main CRUD client-server interface, but I also use Atmosphere framework as server-push mechanism. My aim is multi-client application. All clients must receive notification about changes made by anyone. The communication looks like this: @ProxyFor(TestEntity.class) TestProxy extends EntityProxy | | TestProxy obj |RF update entity--|--- RequestFactory Servlet | | | | | | | | | | | | AutoBeanTestProxy obj |--Atmosphere notification-|-| Atmosphere Servlet creates AutoBeanTestProxy | with entity to all client | | | | | | | | | | | | | client server But RF adds to AutoBean some kind of additional information. Therefore I can't use autobaen received from Atmosphere in next communication by RF channel. How I can create autobean as RF does it? -- 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-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.
What is autobean wrapping is good for?
I am investigating the usage of gwt autobean in my projects. When I was reading about this component, I came across a concept of autobean wrapping but found neither explanation why it was created nor examples of how to use it. What is it good for? Where can I use it? -- 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/-/h3AV_aTxdq4J. 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.
Re: What is autobean wrapping is good for?
On Tuesday, March 20, 2012 10:55:37 AM UTC+1, Konstantin Solomatov wrote: I am investigating the usage of gwt autobean in my projects. When I was reading about this component, I came across a concept of autobean wrapping but found neither explanation why it was created nor examples of how to use it. What is it good for? Where can I use it? It's useful to serialize/deserialize to/from JSON into an existing instance implementing your interface, where that instance can be an AutoBean or an instance of a concrete class (or whatever) implementing your interface. Your object could, for example, be a JPA, JDO or Objectify entity, and by extracting an interface out of the concrete class, you can then easily serialize it to JSON *and* use that same interface on the client side (otherwise, you could have just used GSON or similar). It could be useful too, I guess, for visiting the properties of an object: if the object implements an interface, you can create a wrapping AutoBean using that interface and then use an AutoBeanVisitor; though I cannot find a real use-case for that. -- 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/-/J5LBncdVIvkJ. 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.
NullPointerException when dealing with HashMap and AutoBean
Hi Guys, I have some problem when decoding some JSON data using the AutoBeanCodex. I have an AutoBean that contains getters and setters for some privitive types and also for some Map too. When i deserialize a json with the AutoBeanCodex, i can deserialize the primitive types without any problem, but when i try to deserialize a Map i get NullPointerException, however I can see in the json string that the variable contains data. Here is some source code: public class Deserializer { private String msg = {\myInt\:2010,\myMap\:{\8.0\:true}; private Options options; public Deserializer() { FilterOptionsBeanFactory myFactory = AutoBeanFactorySource.create(OptionsBeanFactory.class); options = AutoBeanCodex.decode(myFactory, Options.class,msg ).g // This works fine System.out.println(options.getMyInt()); // This generates NPE System.out.println(options.getMyMap()); } } public interface Options { MapDouble, Boolean public int getMyInt(); void setMyInt(int myInt); MapDouble, Boolean getMyMap(); void setMyMap(MapDouble, Boolean myMap); } -- 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-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.
Problems with AutoBean Lists
I am having problems modifying a list property on an AutoBean deserialized from JSON with AutoBeanCodex. When I call List.add(position, value) it appears to be overwriting the value at that position instead of shifting values right to make room for the new item. Here's a JUnit test that demonstrates the behavior I'm seeing: public class AutoBeanListTest extends GWTTestCase { @Override public String getModuleName() { return com.xxx.AutoBeanListTest; } @Test public void testDirectInsert() { MyBeanFactory factory = GWT.create(MyBeanFactory.class); MyBean bean = factory.myBean().as(); bean.setValues(new ArrayListString()); bean.getValues().add(A); bean.getValues().add(C); assertEquals(2,bean.getValues().size()); bean.getValues().add(1,B); assertEquals(3,bean.getValues().size()); // this one works assertEquals(A, bean.getValues().get(0)); assertEquals(B, bean.getValues().get(1)); assertEquals(C, bean.getValues().get(2)); } @Test public void testSerializeInsert() { MyBeanFactory factory = GWT.create(MyBeanFactory.class); MyBean bean = factory.myBean().as(); bean.setValues(new ArrayListString()); bean.getValues().add(A); bean.getValues().add(C); assertEquals(2,bean.getValues().size()); String json = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(bean)).getPayload(); bean = AutoBeanCodex.decode(factory, MyBean.class, json).as(); assertEquals(2,bean.getValues().size()); bean.getValues().add(1,B); assertEquals(3,bean.getValues().size()); // this one FAILS assertEquals(A, bean.getValues().get(0)); assertEquals(B, bean.getValues().get(1)); assertEquals(C, bean.getValues().get(2)); } public interface MyBeanFactory extends AutoBeanFactory { AutoBeanMyBean myBean(); AutoBeanMyBean myBean(MyBean myBean); } public interface MyBean { ListString getValues(); void setValues(ListString values); } } The first test case (which modifies a list that I create and put into the bean) works as I expect, but the second test (which modifies the list returned from deserialization) does not. After the insert, the list still has only two values in it, and the second one has been replaced by the value I inserted. Am I doing something wrong? Is this an issue in the underlying code? I can't help but notice that the SplittableList class uses the same implementation for set() and add(). That doesn't seem right to me, but I assume I must be missing something. James -- 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-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.
Re: RequestFactory - Intermittent The AutoBean has been frozen on newly created
That was it. *facepalm* Thanks for the help guys. On Dec 29, 3:56 pm, Thomas Broyer t.bro...@gmail.com wrote: I confirm the need to always use the same instance on the server side in a given request. I do believe it's a bug though fwiw. -- 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-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.
Re: RequestFactory - Intermittent The AutoBean has been frozen on newly created
Yeah, I put that code into a click handler for a button so I can just repeatedly fire it off. It's the only code in the function. It seems like something is trying to edit the result before my receiver callbacks are called. I say that because it works on the server side every single time. If I click that button 5 times, I'll end up with 5 entities in my data store. On Dec 28, 10:09 am, Aidan O'Kelly aida...@gmail.com wrote: From the code you posted, it should work fine (even the original code). Is it all executed in one function? It sounds like there's some paths of execution which differ from it, and somehow end up calling setName() on a frozen proxy. -- 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-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.
Re: RequestFactory - Intermittent The AutoBean has been frozen on newly created
In your addOrUpdate() method, check to see you are returning the exact same instance that was passed in, just remembered I did actually run into the same problem when you return a different instance that has the same identity. On Thu, Dec 29, 2011 at 4:38 PM, Jeff Rodriguez j...@jeffrodriguez.comwrote: Yeah, I put that code into a click handler for a button so I can just repeatedly fire it off. It's the only code in the function. It seems like something is trying to edit the result before my receiver callbacks are called. I say that because it works on the server side every single time. If I click that button 5 times, I'll end up with 5 entities in my data store. On Dec 28, 10:09 am, Aidan O'Kelly aida...@gmail.com wrote: From the code you posted, it should work fine (even the original code). Is it all executed in one function? It sounds like there's some paths of execution which differ from it, and somehow end up calling setName() on a frozen proxy. -- 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-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. -- 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-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.