throws PropertySetterException
{
Method setter = prop.getWriteMethod();
if ( setter == null )
{
throw new PropertySetterException( "No setter for property" );
}
Class[] paramTypes = setter.getParameterTypes();
if ( paramTypes.length != 1 )
{
throw new PropertySetterException( "#params for setter != 1" );
}
Object arg;
try
{
arg = convertArg( value, paramTypes[0] );
}
catch ( Throwable t )
{
throw new PropertySetterException( "Conversion to type [" + paramTypes[0] +
"] failed. Reason: " + t );
}
if ( arg == null )
{
throw new PropertySetterException(
"Conversion to type [" + paramTypes[0] + "] failed." );
}
log.debug( "Setting property [" + name + "] to [" + arg + "]." );
try
{
setter.invoke( obj, new Object[]{arg} );
}
catch ( Exception ex )
{
throw new PropertySetterException( ex );
}
}