boolean (String setterName, Object object, Object value, Class<?> valueType) { try { Method method = object.getClass().getMethod(setterName, valueType); method.invoke(object, value); return true; } catch (InvocationTargetException e) { throw new IllegalArgumentException(String.format("Can't call method with name %s for object %s", setterName, object)); } catch (IllegalAccessException e) { throw new IllegalArgumentException(String.format("Can't access to method with name %s for object %s", setterName, object)); } catch (NoSuchMethodException e) { // Do nothing - will try other variants } return false; }