functionsByName.put("tupper", UpperCaseFunction.class.getName());
ValangCondition goodCondition = new ValangCondition("tupper(name) == 'URI'", functionsByName, null);
ValangCondition badCondition = new ValangCondition("tupper(name) == 'Uri'", functionsByName, null);
// creating the validation configuration for the bean.
DefaultBeanValidationConfiguration personValidationConfiguration = new DefaultBeanValidationConfiguration();
personValidationConfiguration.addGlobalRule(new DefaultValidationRule(goodCondition, "good"));
personValidationConfiguration.addGlobalRule(new DefaultValidationRule(badCondition, "bad"));
SimpleBeanValidationConfigurationLoader loader = new SimpleBeanValidationConfigurationLoader();
loader.setClassValidation(Person.class, personValidationConfiguration);
BeanValidator validator = new BeanValidator(loader);