commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Butash, Bob" <bob.but...@eds.com>
Subject Question: BeanUtils.copyProperty(Object bean, String name, Object value)
Date Thu, 13 May 2004 14:50:11 GMT

> Looking for help, I'm trying to copy a property from an indexed value to
> an indexed value.  The snippet of code that I'm trying to do this with is:
> 
> BeanUtils.copyProperty(toBean, fieldName + "[" +  i + "]",
> Array.get(indexedObject, i));
> 
> Now looking at the JavaDoc I do see the warning:
>     Does not support destination properties that are indexed, but only an
> indexed setter 
>     (as opposed to an array setter) is available. 
> 
> This warning is not clear to me, not sure what they are trying to say.  I
> do notice in the parameter description it states that the name Property
> name (can be nested/indexed/mapped/combo).
> 
> I'm not getting an error, the property is just skipped, the info in the
> log is:
> copyProperty(com.eds.common.util.bean.entity.StringDataTransferObject@1a9e
> 723c, listValue[0], 1)
> DEBUG [main] (BeanUtils.java:407) -     target type for property
> 'listValue' is null, so skipping ths setter
> 
> I have the following accessors for the bean in question:
> 
> 	private List listValues;
> 
> 	public List getListValues()
> 	{
> 		if(listValues == null)
> 		{
> 			listValues = new ArrayList();
> 		}
> 		return listValues;
> 	}
> 
> 	public Object getListValue(int index)
> 	{
> 		return getListValues().get(index);
> 	}
> 
> 	public void setListValues(List list)
> 	{
> 		listValues = list;
> 	}
> 
> 	public void setListValue(int index, Object object)
> 	{
> 		getListValues().add(index, object);
> 	}
> 
> 
> Am I calling this method incorrectly for an indexed field?  Does this
> method not support indexed fields at all???
> 
> 
> 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