Examples of usingContext()


Examples of javax.validation.ValidatorFactory.usingContext()

                for (Entry<String, ValidatorFactory> validatorFactory : validatorFactories.entrySet()) {
                    String id = validatorFactory.getKey();
                    ValidatorFactory factory = validatorFactory.getValue();
                    try {
                        containerSystemContext.bind(VALIDATOR_FACTORY_NAMING_CONTEXT + id, factory);
                        containerSystemContext.bind(VALIDATOR_NAMING_CONTEXT + id, factory.usingContext().getValidator());
                    } catch (NameAlreadyBoundException e) {
                        throw new OpenEJBException("ValidatorFactory already exists for module " + id, e);
                    } catch (Exception e) {
                        throw new OpenEJBException(e);
                    }
View Full Code Here

Examples of javax.validation.ValidatorFactory.usingContext()

        {
            return null;
        }

        ValidatorFactory validatorFactory = ExtValBeanValidationContext.getCurrentInstance().getValidatorFactory();
        return validatorFactory
                .usingContext()
                .messageInterpolator(ExtValBeanValidationContext.getCurrentInstance().getMessageInterpolator())
                .constraintValidatorFactory(validatorFactory.getConstraintValidatorFactory())
                .traversableResolver(validatorFactory.getTraversableResolver())
                .getValidator()
View Full Code Here

Examples of javax.validation.ValidatorFactory.usingContext()

                                                            Class[] groups,
                                                            boolean cascadedValidation)
    {
        ValidatorFactory validatorFactory = ExtValBeanValidationContext.getCurrentInstance().getValidatorFactory();
        Set<ConstraintViolation<Object>> result =
                validatorFactory.usingContext()
                .messageInterpolator(ExtValBeanValidationContext.getCurrentInstance().getMessageInterpolator())
                .constraintValidatorFactory(validatorFactory.getConstraintValidatorFactory())
                .traversableResolver(validatorFactory.getTraversableResolver())
                .getValidator()
                .validateValue(baseClass, propertyName, objectToValidate, groups);
View Full Code Here

Examples of javax.validation.ValidatorFactory.usingContext()

                    try {
                        containerSystemContext.bind(VALIDATOR_FACTORY_NAMING_CONTEXT + id, factory);

                        Validator validator;
                        try {
                            validator = factory.usingContext().getValidator();
                        } catch (final Exception e) {
                            validator = (Validator) Proxy.newProxyInstance(appContext.getClassLoader(), new Class<?>[]{Validator.class}, new LazyValidator(factory));
                        }

                        containerSystemContext.bind(VALIDATOR_NAMING_CONTEXT + id, validator);
View Full Code Here

Examples of javax.validation.ValidatorFactory.usingContext()

                for (Entry<String, ValidatorFactory> validatorFactory : validatorFactories.entrySet()) {
                    String id = validatorFactory.getKey();
                    ValidatorFactory factory = validatorFactory.getValue();
                    try {
                        containerSystemContext.bind(VALIDATOR_FACTORY_NAMING_CONTEXT + id, factory);
                        containerSystemContext.bind(VALIDATOR_NAMING_CONTEXT + id, factory.usingContext().getValidator());
                    } catch (NameAlreadyBoundException e) {
                        throw new OpenEJBException("ValidatorFactory already exists for module " + id, e);
                    } catch (Exception e) {
                        throw new OpenEJBException(e);
                    }
View Full Code Here

Examples of javax.validation.ValidatorFactory.usingContext()

    @Override
    public Object getContent() throws NamingException {
        if (validatorContext == null) {
            try {
                ValidatorFactory factory = getValidatorFactory();
                validatorContext = factory.usingContext();
            } catch (ValidationException v) {
                throw (NamingException)new NamingException("Could not create Validator instance").initCause(v);
            }
        }
        return validatorContext.getValidator();       
View Full Code Here

Examples of javax.validation.ValidatorFactory.usingContext()

        else
        {
            factory = Validation.buildDefaultValidatorFactory();

        }
        validator = factory.usingContext().traversableResolver(new JPATraversalResolver(ec)).getValidator();
    }

    /**
     * Validate the constraints of an object
     * @param pc the object
View Full Code Here

Examples of javax.validation.ValidatorFactory.usingContext()

                for (Entry<String, ValidatorFactory> validatorFactory : validatorFactories.entrySet()) {
                    String id = validatorFactory.getKey();
                    ValidatorFactory factory = validatorFactory.getValue();
                    try {
                        containerSystemContext.bind(VALIDATOR_FACTORY_NAMING_CONTEXT + id, factory);
                        containerSystemContext.bind(VALIDATOR_NAMING_CONTEXT + id, factory.usingContext().getValidator());
                    } catch (NameAlreadyBoundException e) {
                        throw new OpenEJBException("ValidatorFactory already exists for module " + id, e);
                    } catch (Exception e) {
                        throw new OpenEJBException(e);
                    }
View Full Code Here

Examples of javax.validation.ValidatorFactory.usingContext()

            }
        });
        try {
            Thread.currentThread().setContextClassLoader(null);
            ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
            ValidatorContext validatorContext = validatorFactory.usingContext();
            validatorContext.messageInterpolator(new MessageInterpolatorImpl());
            beanValidator = validatorContext.getValidator();
        } finally {
            Thread.currentThread().setContextClassLoader(cl);
        }
View Full Code Here

Examples of javax.validation.ValidatorFactory.usingContext()

                throw new FacesException("Could not build a default Bean Validator factory", e);
            }
            context.getExternalContext().getApplicationMap().put(VALIDATOR_FACTORY_KEY, validatorFactory);
        }

        ValidatorContext validatorContext = validatorFactory.usingContext();
        MessageInterpolator jsfMessageInterpolator =
                new JsfAwareMessageInterpolator(context,
                           validatorFactory.getMessageInterpolator());
        validatorContext.messageInterpolator(jsfMessageInterpolator);
        javax.validation.Validator beanValidator = validatorContext.getValidator();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.