class ValidatorUtils {

    private ValidatorUtils() {
    }

    static volatile Validator validator;

    public static Validator getValidator() {<FILL_FUNCTION_BODY>}

    public static <T> T tryValidate(T bean, Class<?>... group) {
        Set<ConstraintViolation<T>> violations = getValidator().validate(bean, group);
        if (!violations.isEmpty()) {
            throw new ValidationException(violations).withSource(bean);
        }

        return bean;
    }

    public static <T> T tryValidate(T bean, String property, Class<?>... group) {
        Set<ConstraintViolation<T>> violations = getValidator().validateProperty(bean, property, group);
        if (!violations.isEmpty()) {
            throw new ValidationException(violations).withSource(bean);
        }

        return bean;
    }

    public static <T> void tryValidate(Class<T> bean, String property, Object value, Class<?>... group) {
        Set<ConstraintViolation<T>> violations = getValidator().validateValue(bean, property, value, group);
        if (!violations.isEmpty()) {
            throw new ValidationException(violations).withSource(value);
        }
    }

}

        if (validator == null) {
            synchronized (ValidatorUtils.class) {
                if (validator != null) {
                    return validator;
                }
                Configuration<?> configuration = Validation
                        .byDefaultProvider()
                        .configure();
                configuration.addProperty(BaseHibernateValidatorConfiguration.LOCALE_RESOLVER_CLASSNAME,
                                          ContextLocaleResolver.class.getName());
                configuration.messageInterpolator(configuration.getDefaultMessageInterpolator());

                ValidatorFactory factory = configuration.buildValidatorFactory();

                return validator = factory.getValidator();
            }
        }
        return validator;
    
<no_super_class>