Class Validation

java.lang.Object
de.knightsoftnet.validators.client.impl.Validation

public class Validation extends Object
This class is the entry point for Bean Validation. Bootstrapping is done as follows:
 {
   @code
   ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
 }
 

Or, equivalently:

 {
   @code
   Configuration<?> configuration = Validation.byDefaultProvider().configure();
   ValidatorFactory factory = configuration.buildValidatorFactory();
 }
 

Only the default provider is available for use, and thus the byProvider and providerResolver methods are not supported. Calling either of these methods will generate an exception.

This class was modified by Google from the original javax.validation.Validation source to make it suitable for GWT.

  • Constructor Details

    • Validation

      public Validation()
  • Method Details

    • buildDefaultValidatorFactory

      public static javax.validation.ValidatorFactory buildDefaultValidatorFactory()
      Build and return a ValidatorFactory instance based on the default Bean Validation provider.

      The provider list is resolved using the default validation provider resolver logic.

      The code is semantically equivalent to Validation.byDefaultProvider().configure().buildValidatorFactory()
      Returns:
      ValidatorFactory instance.
      Throws:
      javax.validation.ValidationException - if the ValidatorFactory cannot be built
    • buildGwtValidatorFactory

      public static javax.validation.ValidatorFactory buildGwtValidatorFactory(AbstractGwtValidatorFactory validatorFactory)
      Build and return a ValidatorFactory instance based on the gwt validation factory given as parameter.

      The code is semantically equivalent to Validation.byDefaultProvider().configure().gwtFactory(validatorFactory).buildValidatorFactory()

      Parameters:
      validatorFactory - gwt validator factory
      Returns:
      ValidatorFactory instance.
      Throws:
      javax.validation.ValidationException - if the ValidatorFactory cannot be built
    • byDefaultProvider

      public static Validation.GenericGwtBootstrapImpl byDefaultProvider()
      Build a Configuration.
       Configuration<?> configuration = Validation.byDefaultProvider().configure();
       ValidatorFactory factory = configuration.buildValidatorFactory();
       

      The first available provider will be returned.

      Returns:
      instance building a generic Configuration complaint with the bootstrap state provided.
    • byProvider

      public static <T extends javax.validation.Configuration<T>, U extends javax.validation.spi.ValidationProvider<T>> javax.validation.bootstrap.ProviderSpecificBootstrap<T> byProvider(Class<U> providerType)
      Unsupported. Always throws an UnsupportedOperationException.
      Type Parameters:
      T - configuration type
      U - validation provider type
      Parameters:
      providerType - class of the provider type
      Returns:
      provider specific bootstrap
      Throws:
      UnsupportedOperationException - not supported