commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Young <mi...@go-mage.com>
Subject Convert raw data to JavaBean using Reflection - BeanUtils
Date Mon, 07 Mar 2005 01:35:34 GMT
Hi I am looking for some direction on how to convert a raw data array into
a Java bean / Value Object.

I have a Java bean

public class PickValueVO extends ValueObject implements java.io.Serializable{
    private String col1 = null;
    private String col2 = null;
    private String col3 = null;

   //getters & Setters
}

I have a raw data array as an object[]
    Object[] data = (Object[]) row.next();

        which might look like [row1_col2_data]

and I have a String Array which contains the corresponding property names
of the java bean that the raw data represents.

String[] attrSubString

        which might look like [col2]


 I would like to copy the contents of the raw array ([row1_col2_data])into
the Java bean and end up with the data in property COL2 using reflection.

I think that the commons beanutils class will help me do this but am not
sure how to go about it, any help would be greatly appreciated

thanks


---------------------------------------------------------------------
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