Examples of ValidatorFactory


Examples of javax.validation.ValidatorFactory

    }
    return property;
  }

  private static ValidatorFactory getValidatorFactory(Map<Object, Object> properties) {
    ValidatorFactory factory = null;
    if ( properties != null ) {
      Object unsafeProperty = properties.get( FACTORY_PROPERTY );
      if ( unsafeProperty != null ) {
        try {
          factory = ValidatorFactory.class.cast( unsafeProperty );
View Full Code Here

Examples of javax.validation.ValidatorFactory

public class BeanValidator extends AbstractGwtValidator {

  private final AbstractGwtValidator validator;

  public BeanValidator(AbstractGwtValidator validator) {
    ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
    this.validator = validator;
    this.validator.init(factory.getConstraintValidatorFactory(),
        factory.getMessageInterpolator(),
        factory.getTraversableResolver());
  }
View Full Code Here

Examples of javax.validation.ValidatorFactory

        this.configuration = configuration;
        this.classLoader = classLoader;
    }

    private ValidatorFactory getDelegate() {
        ValidatorFactory result = delegate;
        if (result == null) {
            synchronized (this) {
                result = delegate;
                if (result == null) {
                    delegate = result = initFactory();
View Full Code Here

Examples of javax.validation.ValidatorFactory

            SecurityActions.setContextClassLoader(classLoader);
            if (configuration == null) {
                ConstraintMapping mapping = new ConstraintMapping();
                HibernateValidatorConfiguration config = Validation.byProvider(HibernateValidator.class).providerResolver(new JbossProviderResolver()).configure();
                config.addMapping(mapping);
                ValidatorFactory factory = config.buildValidatorFactory();
                return factory;

            } else {
                return configuration.buildValidatorFactory();
            }
View Full Code Here

Examples of javax.validation.ValidatorFactory

    private void deployPersistenceUnit(DeploymentPhaseContext phaseContext, DeploymentUnit deploymentUnit, EEModuleDescription eeModuleDescription, Collection<ComponentDescription> components, ServiceTarget serviceTarget, ModuleClassLoader classLoader, PersistenceProviderDeploymentHolder persistenceProviderDeploymentHolder, PersistenceUnitMetadata pu) throws DeploymentUnitProcessingException {
        pu.setClassLoader(classLoader);
        try {
            final HashMap properties = new HashMap();
            if (!ValidationMode.NONE.equals(pu.getValidationMode())) {
                ValidatorFactory validatorFactory = SerializableValidatorFactory.validatorFactory();
                properties.put("javax.persistence.validation.factory", validatorFactory);
            }
            final PersistenceProviderAdaptor adaptor = getPersistenceProviderAdaptor(pu, persistenceProviderDeploymentHolder, deploymentUnit);

View Full Code Here

Examples of javax.validation.ValidatorFactory

        final WeldDeployment deployment = new WeldDeployment(beanDeploymentArchives, extensions, module, subDeploymentLoaders);

        final WeldContainer weldContainer = new WeldContainer(deployment, Environments.EE_INJECT);
        //hook up validation service
        //TODO: we need to change weld so this is a per-BDA service
        final ValidatorFactory factory = deploymentUnit.getAttachment(BeanValidationAttachments.VALIDATOR_FACTORY);
        weldContainer.addWeldService(ValidationServices.class, new WeldValidationServices(factory));

        final EjbInjectionServices ejbInjectionServices = new WeldEjbInjectionServices(deploymentUnit.getServiceRegistry(), eeModuleDescription, eeApplicationDescription, deploymentRoot.getRoot());
        weldContainer.addWeldService(EjbInjectionServices.class, ejbInjectionServices);
        rootBeanDeploymentModule.addService(EjbInjectionServices.class, ejbInjectionServices);
View Full Code Here

Examples of javax.validation.ValidatorFactory

  }

  @SuppressWarnings("UnusedDeclaration")
  public static void activate(ActivationContext activationContext) {
    final Properties properties = activationContext.getConfiguration().getProperties();
    final ValidatorFactory factory;
    try {
      factory = getValidatorFactory( properties );
    }
    catch (IntegrationException e) {
      if ( activationContext.getValidationModes().contains( ValidationMode.CALLBACK ) ) {
View Full Code Here

Examples of javax.validation.ValidatorFactory

    }
    return property;
  }

  private static ValidatorFactory getValidatorFactory(Map<Object, Object> properties) {
    ValidatorFactory factory = null;
    if ( properties != null ) {
      Object unsafeProperty = properties.get( FACTORY_PROPERTY );
      if ( unsafeProperty != null ) {
        try {
          factory = ValidatorFactory.class.cast( unsafeProperty );
View Full Code Here

Examples of javax.validation.ValidatorFactory

    init( factory, properties );
  }

  public void initialize(Configuration cfg) {
    if ( !initialized ) {
      ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
      Properties props = cfg.getProperties();
      init( factory, props );
    }
  }
View Full Code Here

Examples of javax.validation.ValidatorFactory

    * Create a validator
    * @return The validator
    */
   public static Validator createValidator()
   {
      ValidatorFactory vf = createValidatorFactory();

      return vf.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.