commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [betwixt] BeanReader - setXXX(Object)
Date Mon, 07 Apr 2003 16:42:17 GMT
hi brian

i'm pretty sure that this is because betwixt uses the property signature 
to guess the type of object you want to create. so betwixt thinks that you 
want an object of Object type to be created.

there is an added complication with using an Integer object - and that's 
because it's not a bean. you need to pass in the information in the 
constructor rather calling setters.

having said that, i have some ideas about how to support this kind of 
thing which i'll raise on the dev list and see what people think.

- robert

On Friday, April 4, 2003, at 05:55 AM, Brian K. Wallace wrote:

>   I was wondering if there is something I'm missing, or if Betwixt just
>   can't do it as is. Given the following XML:
> <Element>
>   <name>Element 1</name>
>   <value>
>     <Integer>5</Integer
>   </value>
> </Element>
>
> and the following bean mapped to the "Element" XML element:
>
> public class ElementBean {
>   private String mName;
>   private Object mValue;
>
>   public ElementBean() {
>   }
>
>   public void setName(String iName) {
>     mName = iName;
>   }
>
>   public String getName() {
>     return mName;
>   }
>
>
>   public void setValue(Object iValue) {
>     mValue = iValue;
>   }
>
>   public Object getValue() {
>     return mValue;
>   }
> }
>
> Is there any way to get the value (5) into the Element's setValue method
> as an Integer as opposed to an Object?  I rely on being able to reuse
> objects and pulling out the values as appropriate, but with the
> BeanReader, all calls to 'getValue' result in Object@....
> Aside from my 'Object'ion, the reader parses fine. Any help would be
> appreciated.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


Mime
View raw message