public static void validateValueParameter(Class<? extends IValueValidator> validator, String name, Object value) { try { if (validator != NoValueValidator.class) { p("Validating value parameter:" + name + " value:" + value + " validator:" + validator); } validator.newInstance().validate(name, value); } catch (InstantiationException | IllegalAccessException e) { throw new ParameterException("Can't instantiate validator:" + e); } }