Package javax.validation

Examples of javax.validation.BootstrapConfiguration


        "bv-1.0-validation.xml", new Runnable() {

      @Override
      public void run() {
        //given
        BootstrapConfiguration bootstrapConfiguration = ValidatorUtil.getConfiguration()
            .getBootstrapConfiguration();

        //when
        //then
        assertEquals(
            bootstrapConfiguration.getDefaultValidatedExecutableTypes(),
            asSet( ExecutableType.CONSTRUCTORS, ExecutableType.NON_GETTER_METHODS )
        );
      }
    }
    );
View Full Code Here


  @Test
  @TestForIssue(jiraKey = "HV-707")
  public void shouldReturnDefaultExecutableTypesIfNoValidationXmlIsGiven() {
    //given
    BootstrapConfiguration bootstrapConfiguration = ValidatorUtil.getConfiguration()
        .getBootstrapConfiguration();

    //when
    //then
    assertEquals(
        bootstrapConfiguration.getDefaultValidatedExecutableTypes(),
        asSet( ExecutableType.CONSTRUCTORS, ExecutableType.NON_GETTER_METHODS )
    );
  }
View Full Code Here

        "bv-1.0-validation.xml", new Runnable() {

      @Override
      public void run() {
        //given
        BootstrapConfiguration bootstrapConfiguration = ValidatorUtil.getConfiguration()
            .getBootstrapConfiguration();

        //when
        //then
        assertEquals(
            bootstrapConfiguration.getProperties().get( "com.acme.validation.safetyChecking" ),
            "failOnError"
        );
      }
    }
    );
View Full Code Here

    private boolean isExecutableValidationEnabled;

    public BValExtension() { // read the config, could be done in a quicker way but this let us get defaults without duplicating code
        config = Validation.byDefaultProvider().configure();
        try {
            final BootstrapConfiguration bootstrap = config.getBootstrapConfiguration();
            globalExecutableTypes = convertToRuntimeTypes(bootstrap.getDefaultValidatedExecutableTypes());
            isExecutableValidationEnabled = bootstrap.isExecutableValidationEnabled();

            validBean = globalExecutableTypes.contains(ExecutableType.IMPLICIT) || globalExecutableTypes.contains(ExecutableType.ALL);
            validConstructors =validBean || globalExecutableTypes.contains(ExecutableType.CONSTRUCTORS);
            validBusinessMethods = validBean || globalExecutableTypes.contains(ExecutableType.NON_GETTER_METHODS);
            validGetterMethods = globalExecutableTypes.contains(ExecutableType.ALL) || globalExecutableTypes.contains(ExecutableType.GETTER_METHODS);
View Full Code Here

  private boolean hibernateValidatorAlreadyRegistered = false;


  public ValidationExtension() {
    Configuration<?> config = Validation.byDefaultProvider().configure();
    BootstrapConfiguration bootstrap = config.getBootstrapConfiguration();
    globalExecutableTypes = bootstrap.getDefaultValidatedExecutableTypes();
    isExecutableValidationEnabled = bootstrap.isExecutableValidationEnabled();
    validatorFactory = config.buildValidatorFactory();
    validator = validatorFactory.getValidator();

    executableHelper = new ExecutableHelper( new TypeResolutionHelper() );
  }
View Full Code Here

    }
    instance.close();
  }

  private MessageInterpolator createMessageInterpolator(Configuration<?> config) {
    BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
    String messageInterpolatorFqcn = bootstrapConfiguration.getMessageInterpolatorClassName();

    if ( messageInterpolatorFqcn == null ) {
      return config.getDefaultMessageInterpolator();
    }
View Full Code Here

    return createInstance( messageInterpolatorClass );
  }

  private TraversableResolver createTraversableResolver(Configuration<?> config) {
    BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
    String traversableResolverFqcn = bootstrapConfiguration.getTraversableResolverClassName();

    if ( traversableResolverFqcn == null ) {
      return config.getDefaultTraversableResolver();
    }
View Full Code Here

    return createInstance( traversableResolverClass );
  }

  private ParameterNameProvider createParameterNameProvider(Configuration<?> config) {
    BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
    String parameterNameProviderFqcn = bootstrapConfiguration.getParameterNameProviderClassName();

    if ( parameterNameProviderFqcn == null ) {
      return config.getDefaultParameterNameProvider();
    }
View Full Code Here

    return createInstance( parameterNameProviderClass );
  }

  private ConstraintValidatorFactory createConstraintValidatorFactory(Configuration<?> config) {
    BootstrapConfiguration configSource = config.getBootstrapConfiguration();
    String constraintValidatorFactoryFqcn = configSource.getConstraintValidatorFactoryClassName();

    if ( constraintValidatorFactoryFqcn == null ) {
      // use default
      return createInstance( InjectingConstraintValidatorFactory.class );
    }
View Full Code Here

  public ValidationExtension() {
    validatorRegisteredUnderDefaultQualifier = false;
    validatorRegisteredUnderHibernateQualifier = false;

    Configuration<?> config = Validation.byDefaultProvider().configure();
    BootstrapConfiguration bootstrap = config.getBootstrapConfiguration();
    globalExecutableTypes = bootstrap.getDefaultValidatedExecutableTypes();
    isExecutableValidationEnabled = bootstrap.isExecutableValidationEnabled();
    validator = config.buildValidatorFactory().getValidator();
  }
View Full Code Here

TOP

Related Classes of javax.validation.BootstrapConfiguration

Copyright © 2018 www.massapicom. 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.