wms-jax.validation

roupSequence
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import javax.validation.metadata.ConstraintDescriptor;

public abstract interface MessageInterpolator$Context
{
  public abstract ConstraintDescriptor<?> getConstraintDescriptor();
  
  public abstract Object getValidatedValue();
}

/* Location:
 * Qualified Name:     javax.validation.MessageInterpolator.Context
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.util.Locale;
import javax.validation.metadata.ConstraintDescriptor;

public abstract interface MessageInterpolator
{
  public abstract String interpolate(String paramString, Context paramContext);
  
  public abstract String interpolate(String paramString, Context paramContext, Locale paramLocale);
  
  public static abstract interface Context
  {
    public abstract ConstraintDescriptor<?> getConstraintDescriptor();
    
    public abstract Object getValidatedValue();
  }
}

/* Location:
 * Qualified Name:     javax.validation.MessageInterpolator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation.metadata;

import java.util.Set;

public abstract interface BeanDescriptor
  extends ElementDescriptor
{
  public abstract boolean isBeanConstrained();
  
  public abstract PropertyDescriptor getConstraintsForProperty(String paramString);
  
  public abstract Set<PropertyDescriptor> getConstrainedProperties();
}

/* Location:
 * Qualified Name:     javax.validation.metadata.BeanDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation.metadata;

import java.lang.annotation.Annotation;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.validation.ConstraintValidator;
import javax.validation.Payload;

public abstract interface ConstraintDescriptor<T extends Annotation>
{
  public abstract T getAnnotation();
  
  public abstract Set<Class<?>> getGroups();
  
  public abstract Set<Class<? extends Payload>> getPayload();
  
  public abstract List<Class<? extends ConstraintValidator<T, ?>>> getConstraintValidatorClasses();
  
  public abstract Map<String, Object> getAttributes();
  
  public abstract Set<ConstraintDescriptor<?>> getComposingConstraints();
  
  public abstract boolean isReportAsSingleViolation();
}

/* Location:
 * Qualified Name:     javax.validation.metadata.ConstraintDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation.metadata;

import java.lang.annotation.ElementType;
import java.util.Set;

public abstract interface ElementDescriptor$ConstraintFinder
{
  public abstract ConstraintFinder unorderedAndMatchingGroups(Class<?>... paramVarArgs);
  
  public abstract ConstraintFinder lookingAt(Scope paramScope);
  
  public abstract ConstraintFinder declaredOn(ElementType... paramVarArgs);
  
  public abstract Set<ConstraintDescriptor<?>> getConstraintDescriptors();
  
  public abstract boolean hasConstraints();
}

/* Location:
 * Qualified Name:     javax.validation.metadata.ElementDescriptor.ConstraintFinder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation.metadata;

import java.lang.annotation.ElementType;
import java.util.Set;

public abstract interface ElementDescriptor
{
  public abstract boolean hasConstraints();
  
  public abstract Class<?> getElementClass();
  
  public abstract Set<ConstraintDescriptor<?>> getConstraintDescriptors();
  
  public abstract ConstraintFinder findConstraints();
  
  public static abstract interface ConstraintFinder
  {
    public abstract ConstraintFinder unorderedAndMatchingGroups(Class<?>... paramVarArgs);
    
    public abstract ConstraintFinder lookingAt(Scope paramScope);
    
    public abstract ConstraintFinder declaredOn(ElementType... paramVarArgs);
    
    public abstract Set<ConstraintDescriptor<?>> getConstraintDescriptors();
    
    public abstract boolean hasConstraints();
  }
}

/* Location:
 * Qualified Name:     javax.validation.metadata.ElementDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation.metadata;

public abstract interface PropertyDescriptor
  extends ElementDescriptor
{
  public abstract boolean isCascaded();
  
  public abstract String getPropertyName();
}

/* Location:
 * Qualified Name:     javax.validation.metadata.PropertyDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation.metadata;

public enum Scope
{
  LOCAL_ELEMENT,  HIERARCHY;
  
  private Scope() {}
}

/* Location:
 * Qualified Name:     javax.validation.metadata.Scope
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target({java.lang.annotation.ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface OverridesAttribute$List
{
  OverridesAttribute[] value();
}

/* Location:
 * Qualified Name:     javax.validation.OverridesAttribute.List
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target({java.lang.annotation.ElementType.METHOD})
public @interface OverridesAttribute
{
  Class<? extends Annotation> constraint();
  
  String name();
  
  int constraintIndex() default -1;
  
  @Documented
  @Target({java.lang.annotation.ElementType.METHOD})
  @Retention(RetentionPolicy.RUNTIME)
  public static @interface List
  {
    OverridesAttribute[] value();
  }
}

/* Location:
 * Qualified Name:     javax.validation.OverridesAttribute
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

public abstract interface Path$Node
{
  public abstract String getName();
  
  public abstract boolean isInIterable();
  
  public abstract Integer getIndex();
  
  public abstract Object getKey();
}

/* Location:
 * Qualified Name:     javax.validation.Path.Node
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

public abstract interface Path
  extends Iterable<Node>
{
  public static abstract interface Node
  {
    public abstract String getName();
    
    public abstract boolean isInIterable();
    
    public abstract Integer getIndex();
    
    public abstract Object getKey();
  }
}

/* Location:
 * Qualified Name:     javax.validation.Path
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

public abstract interface Payload {}

/* Location:
 * Qualified Name:     javax.validation.Payload
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({java.lang.annotation.ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ReportAsSingleViolation {}

/* Location:
 * Qualified Name:     javax.validation.ReportAsSingleViolation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation.spi;

import javax.validation.ValidationProviderResolver;

public abstract interface BootstrapState
{
  public abstract ValidationProviderResolver getValidationProviderResolver();
  
  public abstract ValidationProviderResolver getDefaultValidationProviderResolver();
}

/* Location:
 * Qualified Name:     javax.validation.spi.BootstrapState
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation.spi;

import java.io.InputStream;
import java.util.Map;
import java.util.Set;
import javax.validation.ConstraintValidatorFactory;
import javax.validation.MessageInterpolator;
import javax.validation.TraversableResolver;

public abstract interface ConfigurationState
{
  public abstract boolean isIgnoreXmlConfiguration();
  
  public abstract MessageInterpolator getMessageInterpolator();
  
  public abstract Set<InputStream> getMappingStreams();
  
  public abstract ConstraintValidatorFactory getConstraintValidatorFactory();
  
  public abstract TraversableResolver getTraversableResolver();
  
  public abstract Map<String, String> getProperties();
}

/* Location:
 * Qualified Name:     javax.validation.spi.ConfigurationState
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation.spi;

import javax.validation.Configuration;
import javax.validation.ValidatorFactory;

public abstract interface ValidationProvider<T extends Configuration<T>>
{
  public abstract T createSpecializedConfiguration(BootstrapState paramBootstrapState);
  
  public abstract Configuration<?> createGenericConfiguration(BootstrapState paramBootstrapState);
  
  public abstract ValidatorFactory buildValidatorFactory(ConfigurationState paramConfigurationState);
}

/* Location:
 * Qualified Name:     javax.validation.spi.ValidationProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.lang.annotation.ElementType;

public abstract interface TraversableResolver
{
  public abstract boolean isReachable(Object paramObject, Path.Node paramNode, Class<?> paramClass, Path paramPath, ElementType paramElementType);
  
  public abstract boolean isCascadable(Object paramObject, Path.Node paramNode, Class<?> paramClass, Path paramPath, ElementType paramElementType);
}

/* Location:
 * Qualified Name:     javax.validation.TraversableResolver
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

public class UnexpectedTypeException
  extends ConstraintDeclarationException
{
  public UnexpectedTypeException(String message)
  {
    super(message);
  }
  
  public UnexpectedTypeException() {}
  
  public UnexpectedTypeException(String message, Throwable cause)
  {
    super(message, cause);
  }
  
  public UnexpectedTypeException(Throwable cause)
  {
    super(cause);
  }
}

/* Location:
 * Qualified Name:     javax.validation.UnexpectedTypeException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface Valid {}

/* Location:
 * Qualified Name:     javax.validation.Valid
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

class Validation$1 {}

/* Location:
 * Qualified Name:     javax.validation.Validation.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import javax.validation.spi.ValidationProvider;

class Validation$DefaultValidationProviderResolver
  implements ValidationProviderResolver
{
  private static final Map<ClassLoader, List<ValidationProvider<?>>> providersPerClassloader = new WeakHashMap();
  private static final String SERVICES_FILE = "META-INF/services/" + ValidationProvider.class.getName();
  
  public List<ValidationProvider<?>> getValidationProviders()
  {
    ClassLoader classloader = Validation.GetClassLoader.fromContext();
    if (classloader == null) {
      classloader = Validation.GetClassLoader.fromClass(DefaultValidationProviderResolver.class);
    }
    List<ValidationProvider<?>> providers;
    synchronized (providersPerClassloader)
    {
      providers = (List)providersPerClassloader.get(classloader);
    }
    if (providers == null)
    {
      providers = new ArrayList();
      String name = null;
      try
      {
        Object providerDefinitions = classloader.getResources(SERVICES_FILE);
        while (((Enumeration)providerDefinitions).hasMoreElements())
        {
          URL url = (URL)((Enumeration)providerDefinitions).nextElement();
          InputStream stream = url.openStream();
          try
          {
            BufferedReader reader = new BufferedReader(new InputStreamReader(stream), 100);
            name = reader.readLine();
            while (name != null)
            {
              name = name.trim();
              if (!name.startsWith("#"))
              {
                Class<?> providerClass = loadClass(name, DefaultValidationProviderResolver.class);
                
                providers.add((ValidationProvider)providerClass.newInstance());
              }
              name = reader.readLine();
            }
          }
          finally
          {
            stream.close();
          }
        }
      }
      catch (IOException e)
      {
        throw new ValidationException("Unable to read " + SERVICES_FILE, e);
      }
      catch (ClassNotFoundException e)
      {
        throw new ValidationException("Unable to load Bean Validation provider " + name, e);
      }
      catch (IllegalAccessException e)
      {
        throw new ValidationException("Unable to instanciate Bean Validation provider" + name, e);
      }
      catch (InstantiationException e)
      {
        throw new ValidationException("Unable to instanciate Bean Validation provider" + name, e);
      }
      synchronized (providersPerClassloader)
      {
        providersPerClassloader.put(classloader, providers);
      }
    }
    return providers;
  }
  
  private static Class<?> loadClass(String name, Class<?> caller)
    throws ClassNotFoundException
  {
    try
    {
      ClassLoader loader = Validation.GetClassLoader.fromContext();
      if (loader != null) {
        return loader.loadClass(name);
      }
    }
    catch (ClassNotFoundException e)
    {
      if (caller == null) {
        throw e;
      }
    }
    return Class.forName(name, true, Validation.GetClassLoader.fromClass(caller));
  }
}

/* Location:
 * Qualified Name:     javax.validation.Validation.DefaultValidationProviderResolver
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.util.List;
import javax.validation.bootstrap.GenericBootstrap;
import javax.validation.spi.BootstrapState;
import javax.validation.spi.ValidationProvider;

class Validation$GenericBootstrapImpl
  implements GenericBootstrap, BootstrapState
{
  private ValidationProviderResolver resolver;
  private ValidationProviderResolver defaultResolver;
  
  public GenericBootstrap providerResolver(ValidationProviderResolver resolver)
  {
    this.resolver = resolver;
    return this;
  }
  
  public ValidationProviderResolver getValidationProviderResolver()
  {
    return resolver;
  }
  
  public ValidationProviderResolver getDefaultValidationProviderResolver()
  {
    if (defaultResolver == null) {
      defaultResolver = new Validation.DefaultValidationProviderResolver(null);
    }
    return defaultResolver;
  }
  
  public Configuration<?> configure()
  {
    ValidationProviderResolver resolver = this.resolver == null ? getDefaultValidationProviderResolver() : this.resolver;
    List<ValidationProvider<?>> resolvers;
    try
    {
      resolvers = resolver.getValidationProviders();
    }
    catch (RuntimeException re)
    {
      throw new ValidationException("Unable to get available provider resolvers.", re);
    }
    if (resolvers.size() == 0) {
      throw new ValidationException("Unable to find a default provider");
    }
    Configuration<?> config;
    try
    {
      config = ((ValidationProvider)resolver.getValidationProviders().get(0)).createGenericConfiguration(this);
    }
    catch (RuntimeException re)
    {
      throw new ValidationException("Unable to instantiate Configuration.", re);
    }
    return config;
  }
}

/* Location:
 * Qualified Name:     javax.validation.Validation.GenericBootstrapImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.security.AccessController;
import java.security.PrivilegedAction;

class Validation$GetClassLoader
  implements PrivilegedAction<ClassLoader>
{
  private final Class<?> clazz;
  
  public static ClassLoader fromContext()
  {
    GetClassLoader action = new GetClassLoader(null);
    if (System.getSecurityManager() != null) {
      return (ClassLoader)AccessController.doPrivileged(action);
    }
    return action.run();
  }
  
  public static ClassLoader fromClass(Class<?> clazz)
  {
    if (clazz == null) {
      throw new IllegalArgumentException("Class is null");
    }
    GetClassLoader action = new GetClassLoader(clazz);
    if (System.getSecurityManager() != null) {
      return (ClassLoader)AccessController.doPrivileged(action);
    }
    return action.run();
  }
  
  private Validation$GetClassLoader(Class<?> clazz)
  {
    this.clazz = clazz;
  }
  
  public ClassLoader run()
  {
    if (clazz != null) {
      return clazz.getClassLoader();
    }
    return Thread.currentThread().getContextClassLoader();
  }
}

/* Location:
 * Qualified Name:     javax.validation.Validation.GetClassLoader
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.util.List;
import javax.validation.bootstrap.ProviderSpecificBootstrap;
import javax.validation.spi.ValidationProvider;

class Validation$ProviderSpecificBootstrapImpl<T extends Configuration<T>, U extends ValidationProvider<T>>
  implements ProviderSpecificBootstrap<T>
{
  private final Class<U> validationProviderClass;
  private ValidationProviderResolver resolver;
  
  public Validation$ProviderSpecificBootstrapImpl(Class<U> validationProviderClass)
  {
    this.validationProviderClass = validationProviderClass;
  }
  
  public ProviderSpecificBootstrap<T> providerResolver(ValidationProviderResolver resolver)
  {
    this.resolver = resolver;
    return this;
  }
  
  public T configure()
  {
    if (validationProviderClass == null) {
      throw new ValidationException("builder is mandatory. Use Validation.byDefaultProvider() to use the generic provider discovery mechanism");
    }
    Validation.GenericBootstrapImpl state = new Validation.GenericBootstrapImpl(null);
    if (resolver == null) {
      resolver = state.getDefaultValidationProviderResolver();
    } else {
      state.providerResolver(resolver);
    }
    List<ValidationProvider<?>> resolvers;
    try
    {
      resolvers = resolver.getValidationProviders();
    }
    catch (RuntimeException re)
    {
      throw new ValidationException("Unable to get available provider resolvers.", re);
    }
    for (ValidationProvider provider : resolvers) {
      if (validationProviderClass.isAssignableFrom(provider.getClass()))
      {
        ValidationProvider<T> specificProvider = (ValidationProvider)validationProviderClass.cast(provider);
        return specificProvider.createSpecializedConfiguration(state);
      }
    }
    throw new ValidationException("Unable to find provider: " + validationProviderClass);
  }
}

/* Location:
 * Qualified Name:     javax.validation.Validation.ProviderSpecificBootstrapImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import javax.validation.bootstrap.GenericBootstrap;
import javax.validation.bootstrap.ProviderSpecificBootstrap;
import javax.validation.spi.BootstrapState;
import javax.validation.spi.ValidationProvider;

public class Validation
{
  public static ValidatorFactory buildDefaultValidatorFactory()
  {
    return byDefaultProvider().configure().buildValidatorFactory();
  }
  
  public static GenericBootstrap byDefaultProvider()
  {
    return new GenericBootstrapImpl(null);
  }
  
  public static <T extends Configuration<T>, U extends ValidationProvider<T>> ProviderSpecificBootstrap<T> byProvider(Class<U> providerType)
  {
    return new ProviderSpecificBootstrapImpl(providerType);
  }
  
  private static class ProviderSpecificBootstrapImpl<T extends Configuration<T>, U extends ValidationProvider<T>>
    implements ProviderSpecificBootstrap<T>
  {
    private final Class<U> validationProviderClass;
    private ValidationProviderResolver resolver;
    
    public ProviderSpecificBootstrapImpl(Class<U> validationProviderClass)
    {
      this.validationProviderClass = validationProviderClass;
    }
    
    public ProviderSpecificBootstrap<T> providerResolver(ValidationProviderResolver resolver)
    {
      this.resolver = resolver;
      return this;
    }
    
    public T configure()
    {
      if (validationProviderClass == null) {
        throw new ValidationException("builder is mandatory. Use Validation.byDefaultProvider() to use the generic provider discovery mechanism");
      }
      Validation.GenericBootstrapImpl state = new Validation.GenericBootstrapImpl(null);
      if (resolver == null) {
        resolver = state.getDefaultValidationProviderResolver();
      } else {
        state.providerResolver(resolver);
      }
      List<ValidationProvider<?>> resolvers;
      try
      {
        resolvers = resolver.getValidationProviders();
      }
      catch (RuntimeException re)
      {
        throw new ValidationException("Unable to get available provider resolvers.", re);
      }
      for (ValidationProvider provider : resolvers) {
        if (validationProviderClass.isAssignableFrom(provider.getClass()))
        {
          ValidationProvider<T> specificProvider = (ValidationProvider)validationProviderClass.cast(provider);
          return specificProvider.createSpecializedConfiguration(state);
        }
      }
      throw new ValidationException("Unable to find provider: " + validationProviderClass);
    }
  }
  
  private static class GenericBootstrapImpl
    implements GenericBootstrap, BootstrapState
  {
    private ValidationProviderResolver resolver;
    private ValidationProviderResolver defaultResolver;
    
    public GenericBootstrap providerResolver(ValidationProviderResolver resolver)
    {
      this.resolver = resolver;
      return this;
    }
    
    public ValidationProviderResolver getValidationProviderResolver()
    {
      return resolver;
    }
    
    public ValidationProviderResolver getDefaultValidationProviderResolver()
    {
      if (defaultResolver == null) {
        defaultResolver = new Validation.DefaultValidationProviderResolver(null);
      }
      return defaultResolver;
    }
    
    public Configuration<?> configure()
    {
      ValidationProviderResolver resolver = this.resolver == null ? getDefaultValidationProviderResolver() : this.resolver;
      List<ValidationProvider<?>> resolvers;
      try
      {
        resolvers = resolver.getValidationProviders();
      }
      catch (RuntimeException re)
      {
        throw new ValidationException("Unable to get available provider resolvers.", re);
      }
      if (resolvers.size() == 0) {
        throw new ValidationException("Unable to find a default provider");
      }
      Configuration<?> config;
      try
      {
        config = ((ValidationProvider)resolver.getValidationProviders().get(0)).createGenericConfiguration(this);
      }
      catch (RuntimeException re)
      {
        throw new ValidationException("Unable to instantiate Configuration.", re);
      }
      return config;
    }
  }
  
  private static class DefaultValidationProviderResolver
    implements ValidationProviderResolver
  {
    private static final Map<ClassLoader, List<ValidationProvider<?>>> providersPerClassloader = new WeakHashMap();
    private static final String SERVICES_FILE = "META-INF/services/" + ValidationProvider.class.getName();
    
    public List<ValidationProvider<?>> getValidationProviders()
    {
      ClassLoader classloader = Validation.GetClassLoader.fromContext();
      if (classloader == null) {
        classloader = Validation.GetClassLoader.fromClass(DefaultValidationProviderResolver.class);
      }
      List<ValidationProvider<?>> providers;
      synchronized (providersPerClassloader)
      {
        providers = (List)providersPerClassloader.get(classloader);
      }
      if (providers == null)
      {
        providers = new ArrayList();
        String name = null;
        try
        {
          Object providerDefinitions = classloader.getResources(SERVICES_FILE);
          while (((Enumeration)providerDefinitions).hasMoreElements())
          {
            URL url = (URL)((Enumeration)providerDefinitions).nextElement();
            InputStream stream = url.openStream();
            try
            {
              BufferedReader reader = new BufferedReader(new InputStreamReader(stream), 100);
              name = reader.readLine();
              while (name != null)
              {
                name = name.trim();
                if (!name.startsWith("#"))
                {
                  Class<?> providerClass = loadClass(name, DefaultValidationProviderResolver.class);
                  
                  providers.add((ValidationProvider)providerClass.newInstance());
                }
                name = reader.readLine();
              }
            }
            finally
            {
              stream.close();
            }
          }
        }
        catch (IOException e)
        {
          throw new ValidationException("Unable to read " + SERVICES_FILE, e);
        }
        catch (ClassNotFoundException e)
        {
          throw new ValidationException("Unable to load Bean Validation provider " + name, e);
        }
        catch (IllegalAccessException e)
        {
          throw new ValidationException("Unable to instanciate Bean Validation provider" + name, e);
        }
        catch (InstantiationException e)
        {
          throw new ValidationException("Unable to instanciate Bean Validation provider" + name, e);
        }
        synchronized (providersPerClassloader)
        {
          providersPerClassloader.put(classloader, providers);
        }
      }
      return providers;
    }
    
    private static Class<?> loadClass(String name, Class<?> caller)
      throws ClassNotFoundException
    {
      try
      {
        ClassLoader loader = Validation.GetClassLoader.fromContext();
        if (loader != null) {
          return loader.loadClass(name);
        }
      }
      catch (ClassNotFoundException e)
      {
        if (caller == null) {
          throw e;
        }
      }
      return Class.forName(name, true, Validation.GetClassLoader.fromClass(caller));
    }
  }
  
  private static class GetClassLoader
    implements PrivilegedAction<ClassLoader>
  {
    private final Class<?> clazz;
    
    public static ClassLoader fromContext()
    {
      GetClassLoader action = new GetClassLoader(null);
      if (System.getSecurityManager() != null) {
        return (ClassLoader)AccessController.doPrivileged(action);
      }
      return action.run();
    }
    
    public static ClassLoader fromClass(Class<?> clazz)
    {
      if (clazz == null) {
        throw new IllegalArgumentException("Class is null");
      }
      GetClassLoader action = new GetClassLoader(clazz);
      if (System.getSecurityManager() != null) {
        return (ClassLoader)AccessController.doPrivileged(action);
      }
      return action.run();
    }
    
    private GetClassLoader(Class<?> clazz)
    {
      this.clazz = clazz;
    }
    
    public ClassLoader run()
    {
      if (clazz != null) {
        return clazz.getClassLoader();
      }
      return Thread.currentThread().getContextClassLoader();
    }
  }
}

/* Location:
 * Qualified Name:     javax.validation.Validation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

public class ValidationException
  extends RuntimeException
{
  public ValidationException(String message)
  {
    super(message);
  }
  
  public ValidationException() {}
  
  public ValidationException(String message, Throwable cause)
  {
    super(message, cause);
  }
  
  public ValidationException(Throwable cause)
  {
    super(cause);
  }
}

/* Location:
 * Qualified Name:     javax.validation.ValidationException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.util.List;
import javax.validation.spi.ValidationProvider;

public abstract interface ValidationProviderResolver
{
  public abstract List<ValidationProvider<?>> getValidationProviders();
}

/* Location:
 * Qualified Name:     javax.validation.ValidationProviderResolver
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

import java.util.Set;
import javax.validation.metadata.BeanDescriptor;

public abstract interface Validator
{
  public abstract <T> Set<ConstraintViolation<T>> validate(T paramT, Class<?>... paramVarArgs);
  
  public abstract <T> Set<ConstraintViolation<T>> validateProperty(T paramT, String paramString, Class<?>... paramVarArgs);
  
  public abstract <T> Set<ConstraintViolation<T>> validateValue(Class<T> paramClass, String paramString, Object paramObject, Class<?>... paramVarArgs);
  
  public abstract BeanDescriptor getConstraintsForClass(Class<?> paramClass);
  
  public abstract <T> T unwrap(Class<T> paramClass);
}

/* Location:
 * Qualified Name:     javax.validation.Validator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

public abstract interface ValidatorContext
{
  public abstract ValidatorContext messageInterpolator(MessageInterpolator paramMessageInterpolator);
  
  public abstract ValidatorContext traversableResolver(TraversableResolver paramTraversableResolver);
  
  public abstract ValidatorContext constraintValidatorFactory(ConstraintValidatorFactory paramConstraintValidatorFactory);
  
  public abstract Validator getValidator();
}

/* Location:
 * Qualified Name:     javax.validation.ValidatorContext
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.validation;

public abstract interface ValidatorFactory
{
  public abstract Validator getValidator();
  
  public abstract ValidatorContext usingContext();
  
  public abstract MessageInterpolator getMessageInterpolator();
  
  public abstract TraversableResolver getTraversableResolver();
  
  public abstract ConstraintValidatorFactory getConstraintValidatorFactory();
  
  public abstract <T> T unwrap(Class<T> paramClass);
}

/* Location:
 * Qualified Name:     javax.validation.ValidatorFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.constraints;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
import org.hibernate.validator.constraints.impl.EmailValidator;

@Documented
@Constraint(validatedBy={EmailValidator.class})
@Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.ANNOTATION_TYPE, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface Email
{
  String message() default "{org.hibernate.validator.constraints.Email.message}";
  
  Class<?>[] groups() default {};
  
  Class<? extends Payload>[] payload() default {};
}

/* Location:
 * Qualified Name:     org.hibernate.validator.constraints.Email
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.constraints.impl;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.AssertFalse;

public class AssertFalseValidator
  implements ConstraintValidator<AssertFalse, Boolean>
{
  public void initialize(AssertFalse constraintAnnotation) {}
  
  public boolean isValid(Boolean bool, ConstraintValidatorContext constraintValidatorContext)
  {
    return (bool == null) || (!bool.booleanValue());
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.constraints.impl.AssertFalseValidator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.constraints.impl;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.AssertTrue;

public class AssertTrueValidator
  implements ConstraintValidator<AssertTrue, Boolean>
{
  public void initialize(AssertTrue constraintAnnotation) {}
  
  public boolean isValid(Boolean bool, ConstraintValidatorContext constraintValidatorContext)
  {
    return (bool == null) || (bool.booleanValue());
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.constraints.impl.AssertTrueValidator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.constraints.impl;

import java.math.BigDecimal;
import java.math.BigInteger;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.DecimalMax;

public class DecimalMaxValidatorForNumber
  implements ConstraintValidator<DecimalMax, Number>
{
  private BigDecimal maxValue;
  
  public void initialize(DecimalMax maxValue)
  {
    try
    {
      this.maxValue = new BigDecimal(maxValue.value());
    }
    catch (NumberFormatException nfe)
    {
      throw new IllegalArgumentException(maxValue.value() + " does not represent a valid BigDecimal format");
    }
  }
  
  public boolean isValid(Number value, ConstraintValidatorContext constraintValidatorContext)
  {
    if (value == null) {
      return true;
    }
    if ((value instanceof BigDecimal)) {
      return ((BigDecimal)value).compareTo(maxValue) != 1;
    }
    if ((value instanceof BigInteger)) {
      return new BigDecimal((BigInteger)value).compareTo(maxValue) != 1;
    }
    return new BigDecimal(value.doubleValue()).compareTo(maxValue) != 1;
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.constraints.impl.DecimalMaxValidatorForNumber
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.constraints.impl;

import java.math.BigDecimal;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.DecimalMax;

public class DecimalMaxValidatorForString
  implements ConstraintValidator<DecimalMax, String>
{
  private BigDecimal maxValue;
  
  public void initialize(DecimalMax maxValue)
  {
    try
    {
      this.maxValue = new BigDecimal(maxValue.value());
    }
    catch (NumberFormatException nfe)
    {
      throw new IllegalArgumentException(maxValue.value() + " does not represent a valid BigDecimal format");
    }
  }
  
  public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext)
  {
    if (value == null) {
      return true;
    }
    try
    {
      return new BigDecimal(value).compareTo(maxValue) != 1;
    }
    catch (NumberFormatException nfe) {}
    return false;
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.constraints.impl.DecimalMaxValidatorForString
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.constraints.impl;

import java.math.BigDecimal;
import java.math.BigInteger;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.DecimalMin;

public class DecimalMinValidatorForNumber
  implements ConstraintValidator<DecimalMin, Number>
{
  private BigDecimal minValue;
  
  public void initialize(DecimalMin minValue)
  {
    try
    {
      this.minValue = new BigDecimal(minValue.value());
    }
    catch (NumberFormatException nfe)
    {
      throw new IllegalArgumentException(minValue.value() + " does not represent a valid BigDecimal format");
    }
  }
  
  public boolean isValid(Number value, ConstraintValidatorContext constraintValidatorContext)
  {
    if (value == null) {
      return true;
    }
    if ((value instanceof BigDecimal)) {
      return ((BigDecimal)value).compareTo(minValue) != -1;
    }
    if ((value instanceof BigInteger)) {
      return new BigDecimal((BigInteger)value).compareTo(minValue) != -1;
    }
    return new BigDecimal(value.doubleValue()).compareTo(minValue) != -1;
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.constraints.impl.DecimalMinValidatorForNumber
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.constraints.impl;

import java.math.BigDecimal;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.DecimalMin;

public class DecimalMinValidatorForString
  implements ConstraintValidator<DecimalMin, String>
{
  private BigDecimal minValue;
  
  public void initialize(DecimalMin minValue)
  {
    try
    {
      this.minValue = new BigDecimal(minValue.value());
    }
    catch (NumberFormatException nfe)
    {
      throw new IllegalArgumentException(minValue.value() + " does not represent a valid BigDecimal format");
    }
  }
  
  public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext)
  {
    if (value == null) {
      return true;
    }
    try
    {
      return new BigDecimal(value).compareTo(minValue) != -1;
    }
    catch (NumberFormatException nfe) {}
    return false;
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.constraints.impl.DecimalMinValidatorForString
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.constraints.impl;

import java.math.BigDecimal;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.Digits;

public class DigitsValidatorForNumber
  implements ConstraintValidator<Digits, Number>
{
  private int maxIntegerLength;
  private int maxFractionLength;
  
  public void initialize(Digits constraintAnnotation)
  {
    maxIntegerLength = constraintAnnotation.integer();
    maxFractionLength = constraintAnnotation.fraction();
    validateParameters();
  }
  
  public boolean isValid(Number num, ConstraintValidatorContext constraintValidatorContext)
  {
    if (num == null) {
      return true;
    }
    BigDecimal bigNum;
    BigDecimal bigNum;
    if ((num instanceof BigDecimal)) {
      bigNum = (BigDecimal)num;
    } else {
      bigNum = new BigDecimal(num.toString()).stripTrailingZeros();
    }
    int integerPartLength = bigNum.precision() - bigNum.scale();
    int fractionPartLength = bigNum.scale() < 0 ? 0 : bigNum.scale();
    
    return (maxIntegerLength >= integerPartLength) && (maxFractionLength >= fractionPartLength);
  }
  
  private void validateParameters()
  {
   
1 2 3 4 5 6 7 8 9 10 11

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd