Comment by [email protected]:
I have another problem and I hope you guys could help me out.
I have an interface named BaseValue
void setValue(String value);
void setValues(List<BaseValue> value);
String getValue();
List<BaseValue> getValues();
and utils methods such as
int getValueAsInt();
As I have understood, I need to create a class to implement the behavior of
such method.
public class Value{
public static int getValueAsInt(AutoBean<BaseValue> instance) {
return Integer.parseInt(instance.as().getValue());
}
}
and the factory interface should have
@Category(Value.class)
but when I do the folowing I can't get it to work
AutoBean<BaseFormData> bean = AutoBeanCodex.decode(
AutoBeanFactorySource.create( JSONBeanFactory.class ),
BaseFormData.class, product );
BaseFormData data = bean.as();
int id = data.getRequest().get( "id" ).getValueAsString();
id is 0. On the other hand data.getRequest().get( "id" ).getValue() returns
the correct value
Could anyone help me on this?
Thanks a lot guys
For more information:
http://code.google.com/p/google-web-toolkit/wiki/AutoBean
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors