void (String settingName, Object value, Class<?> valueType, Object... objects) { for (Object object : objects) { if (setSettingWithField(settingName, object, value) || setSettingWithMethod(settingName, object, value, valueType)) { return; } } throw new IllegalArgumentException(String.format( "There's no property or method with name '%s' in given objects: %s", settingName, Arrays.toString(objects))); }