if ( o.getClass().getName().equals( type.getName() ) ) {
return ( T ) o;
}
else {
String msg = "Wrong parameter type. Expected: " + type.getName() + " Actual: " + o.getClass().getName();
throw new ValidationException( msg );
}
}
catch ( NoSuchMethodException e ) {
String msg = "The specified annotation defines no parameter '" + parameterName + "'.";
throw new ValidationException( msg, e );
}
catch ( IllegalAccessException e ) {
String msg = "Unable to get '" + parameterName + "' from " + annotation.getClass().getName();
throw new ValidationException( msg, e );
}
catch ( InvocationTargetException e ) {
String msg = "Unable to get '" + parameterName + "' from " + annotation.getClass().getName();
throw new ValidationException( msg, e );
}
}