static Object bindElementsToObjectArray( final List< Element > values, final BeanImpl bean )
{
final Class< ? > clazz = bean.getType();
final Object array = ReflectionUtils.newArrayInstance( clazz, values.size() );
final Class< ? > handlerClass = bean.getTypeHandler();
ElementHandler handler;
if ( handlerClass == null )
{
handler = ( ElementHandler ) HandlersRepository.getDefaultHandler( bean, true );
}
else
{
handler = ( ElementHandler ) HandlersRepository.getUserHandler( bean, true );
}
for ( int index = 0; index < values.size(); index++ )
{
final Object boundValue = handler.bind( values.get( index ), clazz );
ReflectionUtils.setArrayValue( array, index, boundValue );
}
return array;
}