code: public static <T> T invokeSetters(final T instance, final Map<String,Object> vars) 
              throws ReflectiveOperationException {
          if (instance != null && vars != null) {
              final Class<?> clazz = instance.getClass();
              final Method[] methods = clazz.getMethods();
              for (final Entry<String,Object> entry : vars.entrySet()) {
                  final String methodName = "set" + entry.getKey().substring(0, 1).toUpperCase(Locale.US) 
                          + entry.getKey().substring(1);
                  boolean found = false;
                  for (final Method method : methods) {
                      if (methodName.equals(method.getName()) && method.getParameterTypes().length == 1) {
                          method.invoke(instance, entry.getValue());
                          found = true;
                          break;
                      }
                  }
                  if (!found) {
                      throw new NoSuchMethodException("Expected setter named '" + methodName 
                              + "' for var '" + entry.getKey() + "'");
                  }
              }
          }
          return instance;
      }
docs: Invoke the setters for the given variables on the given instance.
  @param <T> the instance type
  @param instance the instance to inject with the variables
  @param vars the variables to inject
  @return the instance
  @throws ReflectiveOperationException if there was a problem finding or invoking a setter method