void (boolean enabled) { Object instance = getInstance(); try { MethodHandles.publicLookup() .findVirtual(instance.getClass(), mySetterName, MethodType.methodType(void.class, boolean.class)) .invoke(instance, enabled); } catch (Throwable exception) { LOG.error(String.format("Boolean setter '%s' not found in %s", mySetterName, instance), exception); } fireUpdated(); }