autobean

How to deserialize BigDecimal by using GWT AutoBean?

我是研究僧i 提交于 2020-01-04 13:05:23
问题 I have json coming from server and representing pojos. When i deserialize to json using AutoBean some works some dont! I figure out that those which cant be deserialize has BigDecimal getters/setters. Error: TypeError: Cannot read property 'length' of undefined at java_math_BigDecimal_$initFrom__Ljava_math_BigDecimal_2Ljava_lang_String_2 How to handle BigDecimal into GWT while deserializing with AutoBean? ps: the nested question is this one 回答1: AutoBean expects BigDecimal as strings in the

GWT Autobean Bean is null

匆匆过客 提交于 2019-12-25 16:42:28
问题 Please help me, what I do wrong InfraNameModel public interface InfraNameModel { String getInfraName(); void setInfraName(String infraName); } InfraNameModelImpl public class InfraNameModelImpl implements InfraNameModel { private String infraName; @Override public String getInfraName() { return infraName; } @Override public void setInfraName(String infraName) { this.infraName = infraName; } } InfraNameModelList public interface InfraNameModelList<T extends InfraNameModel> { public List<T>

How to set default value to a GWT AutoBean?

自作多情 提交于 2019-12-23 02:53:56
问题 I have a Class that i wanted to generate his AutoBean. Example.class : public static class Example implements Serializable { public Example2 example2 = new Example2(); public static BigDecimal calc(BigDecimal dec){ return dec != null ? dec: BigDecimal.ZERO; } public static class Example2 implements Serializable { public BigDecimal value1 = BigDecimal.ZERO; public BigDecimal value2 = BigDecimal.ZERO; public BigDecimal getSum(){ return calc(value1).add(calc(value2)); } } } AutoBean Example:

How to serialize a list in AutoBean (GWT)?

拜拜、爱过 提交于 2019-12-22 05:23:41
问题 I'm trying to figure out how to serialize a list using AutoBean in GWT, but I keep getting a Null Pointer Exception. Here's what I have: GuideCreatorFactory beanFactory = AutoBeanFactorySource.create(GuideCreatorFactory.class); List<Guide> guides = new LinkedList<Guide>(); Guide guide = new Guide(); guide.setText("this is the text"); guide.setTitle("this is the title"); guides.add(guide); GuideCreatorList<Guide> impl = new GuideCreatorListImpl(); impl.setGuides(guides); System.out.println(

Parsing JSON objects of unknown type with AutoBean on GWT

徘徊边缘 提交于 2019-12-18 04:16:56
问题 My server returns a list of objects in JSON. They might be Cat s or Dog s, for example. When I know that they'll all be Cat s, I can set the AutoBeanCodex to work easily. When I don't know what types they are, though... what should I do? I could give all of my entities a type field, but then I'd have to parse each entity before passing it to the AutoBeanCodex , which borders on defeating the point. What other options do I have? 回答1: Just got to play with this the other day, and fought it for

which interfaces representations to deserialize from JSON to AutoBean?

社会主义新天地 提交于 2019-12-13 06:25:14
问题 I have the following JSON : { "bean1": { "bean12": { "value1": 4500, "value2": 1500 }, "bean13": { "value1": 1550, "value2": 550 } } } I try to deserialize this json with AutoBean, since i have problem to figure it out. I will like to go the reverse way. Which interfaces can perfect match this JSON so that deserializing with AutoBean work? where bean1, bean12, bean13 are interfaces and the values are all BigDecimal. 回答1: Check this sample. You must have corresponding interface(which has

GWT Autobean set initial value of created interface

不问归期 提交于 2019-12-11 18:26:53
问题 We are using AutoBeans to create our Pojo objects for use in RPC-Calls. What is the recommended approach for the Pojo to have a default value or other class initialization? For example public interface SamplePojo { // should default to 5 int getSampleProperty(); void setSampleProperty(int sampleProperty); } public interface ModelFactory extends AutoBeanFactory { AutoBean<SamplePojo> getSamplePojo(); } And SamplePojo has a int property that we always want to default to 5. 回答1: AutoBeans should

Autobean and XSS issue

倾然丶 夕夏残阳落幕 提交于 2019-12-08 09:31:38
问题 I have a Spring application on the backend and a GWT application on the frontend. When the user is logged in ''index.jsp'' will output the user information as a javascript variable. I am using AutoBeanFactory to encode and decode the user information as json. Because the user can register and the user information are stored in the database I try to follow the OWASP XSS Preventing cheat sheet by escaping the user information in the JSP page. I am using the esapi library to do the encoding. The

How to serialize a list in AutoBean (GWT)?

拜拜、爱过 提交于 2019-12-05 05:44:11
I'm trying to figure out how to serialize a list using AutoBean in GWT, but I keep getting a Null Pointer Exception. Here's what I have: GuideCreatorFactory beanFactory = AutoBeanFactorySource.create(GuideCreatorFactory.class); List<Guide> guides = new LinkedList<Guide>(); Guide guide = new Guide(); guide.setText("this is the text"); guide.setTitle("this is the title"); guides.add(guide); GuideCreatorList<Guide> impl = new GuideCreatorListImpl(); impl.setGuides(guides); System.out.println("Serializing the given parameter to JSON"); // Fails on the below lines w/ NPE AutoBean<GuideCreatorList>

GWT AutoBean with POJO class instead of interface

别说谁变了你拦得住时间么 提交于 2019-12-01 13:53:58
问题 I'm hoping someone can suggest a simple solution to my problem. I have a POJO, say: public class Person { private String name; public String getName(){ return name; } public void setName(String name){ this.name = name; } } I'd like to use GWT's AutoBean functionality to serialize / deserialize this bean to JSON, but AutoBean expects an interface: public interface Person { public String getName(); public void setName(String name); } I have an AutoBeanFactory setup: public interface