private void setValueUsingSetter( Object value )
throws ComponentConfigurationException
{
if ( setterParamType == null || setter == null )
{
throw new ComponentConfigurationException( "No setter found" );
}
String exceptionInfo = object.getClass().getName() + "." + setter.getName() + "( " +
setterParamType.getClass().getName() + " )";
if ( listener != null )
{
listener.notifyFieldChangeUsingSetter( fieldName, value, object );
}
try
{
setter.invoke( object, new Object[]{value} );
}
catch ( IllegalAccessException e )
{
throw new ComponentConfigurationException( "Cannot access method: " + exceptionInfo, e );
}
catch ( IllegalArgumentException e )
{
throw new ComponentConfigurationException(
"Invalid parameter supplied while setting '" + value + "' to " + exceptionInfo, e );
}
catch ( InvocationTargetException e )
{
throw new ComponentConfigurationException( "Setter " + exceptionInfo +
" threw exception when called with parameter '" + value + "': " + e.getTargetException().getMessage(),
e );
}
}