incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosv...@apache.org
Subject svn commit: r962601 [2/4] - in /incubator/bval/trunk: bval-core/src/main/java/org/apache/bval/ bval-core/src/main/java/org/apache/bval/model/ bval-core/src/main/java/org/apache/bval/routines/ bval-core/src/main/java/org/apache/bval/util/ bval-jsr303/sr...
Date Fri, 09 Jul 2010 16:31:18 GMT
Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java Fri Jul  9 16:31:15 2010
@@ -39,46 +39,79 @@ public class ApacheFactoryContext implem
   private TraversableResolver traversableResolver;
   private ConstraintValidatorFactory constraintValidatorFactory;
 
+  /**
+   * Create a new ApacheFactoryContext instance.
+   * @param factory
+   */
   public ApacheFactoryContext(ApacheValidatorFactory factory) {
     this.factory = factory;
     this.metaBeanFinder = buildMetaBeanManager();
   }
 
+  /**
+   * Create a new ApacheFactoryContext instance.
+   * @param factory
+   * @param metaBeanFinder
+   */
   protected ApacheFactoryContext(ApacheValidatorFactory factory,
                                  MetaBeanFinder metaBeanFinder) {
     this.factory = factory;
     this.metaBeanFinder = metaBeanFinder;
   }
 
+  /**
+   * Get the {@link ApacheValidatorFactory} used by this {@link ApacheFactoryContext}.
+   * @return {@link ApacheValidatorFactory}
+   */
   public ApacheValidatorFactory getFactory() {
     return factory;
   }
 
+  /**
+   * Get the metaBeanFinder.
+   * @return {@link MetaBeanFinder}
+   */
   public final MetaBeanFinder getMetaBeanFinder() {
     return metaBeanFinder;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public ValidatorContext messageInterpolator(MessageInterpolator messageInterpolator) {
     this.messageInterpolator = messageInterpolator;
     return this;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public ValidatorContext traversableResolver(TraversableResolver traversableResolver) {
     this.traversableResolver = traversableResolver;
     return this;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public ValidatorContext constraintValidatorFactory(
       ConstraintValidatorFactory constraintValidatorFactory) {
     this.constraintValidatorFactory = constraintValidatorFactory;
     return this;
   }
 
+  /**
+   * Get the {@link ConstraintValidatorFactory}.
+   * @return {@link ConstraintValidatorFactory}
+   */
   public ConstraintValidatorFactory getConstraintValidatorFactory() {
     return constraintValidatorFactory == null ? factory.getConstraintValidatorFactory() :
         constraintValidatorFactory;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public Validator getValidator() {
     ClassValidator validator = new ClassValidator(this);
     if (Boolean.getBoolean(factory.getProperties().get(
@@ -88,11 +121,19 @@ public class ApacheFactoryContext implem
     return validator;
   }
 
+  /**
+   * Get the {@link MessageInterpolator}.
+   * @return {@link MessageInterpolator}
+   */
   public MessageInterpolator getMessageInterpolator() {
     return messageInterpolator == null ? factory.getMessageInterpolator() :
         messageInterpolator;
   }
 
+  /**
+   * Get the {@link TraversableResolver}.
+   * @return {@link TraversableResolver}
+   */
   public TraversableResolver getTraversableResolver() {
     return traversableResolver == null ? factory.getTraversableResolver() :
         traversableResolver;
@@ -105,7 +146,8 @@ public class ApacheFactoryContext implem
    *
    * @return a new instance of MetaBeanManager with adequate MetaBeanFactories
    */
-  protected MetaBeanManager buildMetaBeanManager() {
+  @SuppressWarnings("deprecation")
+protected MetaBeanManager buildMetaBeanManager() {
     // this is relevant: xml before annotations
     // (because ignore-annotations settings in xml)
     List<MetaBeanFactory> builders = new ArrayList<MetaBeanFactory>(3);
@@ -123,6 +165,11 @@ public class ApacheFactoryContext implem
     }
   }
 
+  /**
+   * Create a {@link MetaBeanManager} using the specified builders.
+   * @param builders {@link MetaBeanFactory} {@link List}
+   * @return {@link MetaBeanManager}
+   */
   protected MetaBeanManager createMetaBeanManager(List<MetaBeanFactory> builders) {
     return new MetaBeanManager(
         new MetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()])));
@@ -135,7 +182,12 @@ public class ApacheFactoryContext implem
    */
   private static class XMLMetaBeanManagerCreator {
 
-    protected static MetaBeanManager createXMLMetaBeanManager(List<MetaBeanFactory> builders) {
+    /**
+     * Create the {@link XMLMetaBeanManager}.
+     * @param builders
+     * @return {@link XMLMetaBeanManager}
+     */
+    protected static XMLMetaBeanManager createXMLMetaBeanManager(List<MetaBeanFactory> builders) {
       builders.add(new XMLMetaBeanFactory());
       return new XMLMetaBeanManager(
           new XMLMetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()])));

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidationProvider.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidationProvider.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidationProvider.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidationProvider.java Fri Jul  9 16:31:15 2010
@@ -35,19 +35,31 @@ import javax.validation.spi.ValidationPr
  */
 public class ApacheValidationProvider
       implements ValidationProvider<ApacheValidatorConfiguration> {
+    /**
+     * Learn whether a particular builder class is suitable for this {@link ValidationProvider}.
+     * @param builderClass
+     * @return boolean suitability
+     */
     public boolean isSuitable(Class<? extends Configuration<?>> builderClass) {
         return ApacheValidatorConfiguration.class == builderClass;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ConfigurationImpl createSpecializedConfiguration(BootstrapState state) {
         return new ConfigurationImpl(state, this);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Configuration<?> createGenericConfiguration(BootstrapState state) {
         return new ConfigurationImpl(state, null);
     }
 
     /**
+     * {@inheritDoc}
      * @throws javax.validation.ValidationException
      *          if the ValidatorFactory cannot be built
      */

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java Fri Jul  9 16:31:15 2010
@@ -33,8 +33,8 @@ import java.lang.annotation.Annotation;
 import java.util.*;
 
 /**
- * Description: a factory is a complete configurated object that can create validators<br/>
- * this instance is not thread-safe<br/>
+ * Description: a factory is a complete configurated object that can create validators.<br/>
+ * This instance is not thread-safe.<br/>
  */
 public class ApacheValidatorFactory implements ValidatorFactory, Cloneable {
     private static volatile ApacheValidatorFactory DEFAULT_FACTORY;
@@ -55,8 +55,11 @@ public class ApacheValidatorFactory impl
     private final Map<Class<?>, List<AccessStrategy>> validAccesses;
     private final Map<Class<?>, List<MetaConstraint<?, ? extends Annotation>>> constraintMap;
 
-  /** convenience to retrieve a default global ApacheValidatorFactory */
-    public static ApacheValidatorFactory getDefault() {
+    /**
+     * Convenience method to retrieve a default global ApacheValidatorFactory
+     * @return {@link ApacheValidatorFactory}
+     */
+    public static synchronized ApacheValidatorFactory getDefault() {
         if (DEFAULT_FACTORY == null) {
             ProviderSpecificBootstrap<ApacheValidatorConfiguration> provider =
                   Validation.byProvider(ApacheValidationProvider.class);
@@ -67,10 +70,17 @@ public class ApacheValidatorFactory impl
         return DEFAULT_FACTORY;
     }
 
+    /**
+     * Set a particular {@link ApacheValidatorFactory} instance as the default.
+     * @param aDefaultFactory
+     */
     public static void setDefault(ApacheValidatorFactory aDefaultFactory) {
      DEFAULT_FACTORY = aDefaultFactory;
     }
 
+    /**
+     * Create a new ApacheValidatorFactory instance.
+     */
   public ApacheValidatorFactory() {
         properties = new HashMap<String, String>();
         defaultSequences = new HashMap<Class<?>, Class<?>[]>();
@@ -78,6 +88,11 @@ public class ApacheValidatorFactory impl
         constraintMap = new HashMap<Class<?>, List<MetaConstraint<?, ? extends Annotation>>>();
     }
 
+
+  /**
+   * Configure this {@link ApacheValidatorFactory} from a {@link ConfigurationState}.
+   * @param configuration
+   */
     public void configure(ConfigurationState configuration) {
         getProperties().putAll(configuration.getProperties());
         setMessageInterpolator(configuration.getMessageInterpolator());
@@ -87,16 +102,24 @@ public class ApacheValidatorFactory impl
         parser.processMappingConfig(configuration.getMappingStreams());
     }
 
+    /**
+     * Get the property map of this {@link ApacheValidatorFactory}.
+     * @return Map<String, String>
+     */
     public Map<String, String> getProperties() {
         return properties;
     }
 
+    /**
+     * Get the default {@link MessageInterpolator} used by this {@link ApacheValidatorFactory}.
+     * @return {@link MessageInterpolator}
+     */
     protected MessageInterpolator getDefaultMessageInterpolator() {
         return messageResolver;
     }
 
     /**
-     * shortcut method to create a new Validator instance with factory's settings
+     * Shortcut method to create a new Validator instance with factory's settings
      *
      * @return the new validator instance
      */
@@ -104,11 +127,17 @@ public class ApacheValidatorFactory impl
         return usingContext().getValidator();
     }
 
-    /** @return the validator factory's context */
+    /**
+     * {@inheritDoc}
+     * @return the validator factory's context
+     */
     public ApacheFactoryContext usingContext() {
         return new ApacheFactoryContext(this);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public synchronized ApacheValidatorFactory clone() {
         try {
@@ -118,32 +147,53 @@ public class ApacheValidatorFactory impl
         }
     }
 
+    /**
+     * Set the {@link MessageInterpolator} used.
+     * @param messageResolver
+     */
     public final void setMessageInterpolator(MessageInterpolator messageResolver) {
         this.messageResolver = messageResolver;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public MessageInterpolator getMessageInterpolator() {
         return ((messageResolver != null) ? messageResolver : getDefaultMessageInterpolator());
     }
 
+    /**
+     * Set the {@link TraversableResolver} used.
+     * @param traversableResolver
+     */
     public final void setTraversableResolver(TraversableResolver traversableResolver) {
         this.traversableResolver = traversableResolver;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public TraversableResolver getTraversableResolver() {
         return traversableResolver;
     }
 
-    public ConstraintValidatorFactory getConstraintValidatorFactory() {
-        return constraintValidatorFactory;
-    }
-
+    /**
+     * Set the {@link ConstraintValidatorFactory} used.
+     * @param constraintValidatorFactory
+     */
     public final void setConstraintValidatorFactory(
           ConstraintValidatorFactory constraintValidatorFactory) {
         this.constraintValidatorFactory = constraintValidatorFactory;
     }
 
     /**
+     * {@inheritDoc}
+     */
+    public ConstraintValidatorFactory getConstraintValidatorFactory() {
+        return constraintValidatorFactory;
+    }
+    
+    /**
      * Return an object of the specified type to allow access to the
      * provider-specific API.  If the Bean Validation provider
      * implementation does not support the specified class, the
@@ -154,8 +204,9 @@ public class ApacheValidatorFactory impl
      * @throws ValidationException if the provider does not
      *                             support the call.
      */
+    @SuppressWarnings("unchecked")
     public <T> T unwrap(Class<T> type) {
-        if (type.isAssignableFrom(getClass())) {
+        if (type.isInstance(this)) {
             return (T) this;
         } else if (!type.isInterface()) {
             return SecureActions.newInstance(type);
@@ -169,18 +220,35 @@ public class ApacheValidatorFactory impl
         }
     }
 
+    /**
+     * Get the detected {@link ConstraintDefaults}.
+     * @return ConstraintDefaults
+     */
     public ConstraintDefaults getDefaultConstraints() {
         return defaultConstraints;
     }
 
+    /**
+     * Get the detected {@link AnnotationIgnores}. 
+     * @return AnnotationIgnores
+     */
     public AnnotationIgnores getAnnotationIgnores() {
         return annotationIgnores;
     }
 
+    /**
+     * Get the constraint cache used.
+     * @return {@link ConstraintCached}
+     */
     public ConstraintCached getConstraintsCache() {
         return constraintsCache;
     }
 
+    /**
+     * Add a meta-constraint to this {@link ApacheValidatorFactory}'s runtime customizations.
+     * @param beanClass
+     * @param metaConstraint
+     */
     public void addMetaConstraint(Class<?> beanClass, MetaConstraint<?, ?> metaConstraint) {
         List<MetaConstraint<?,? extends Annotation>> slot = constraintMap.get(beanClass);
         if (slot != null) {
@@ -193,21 +261,38 @@ public class ApacheValidatorFactory impl
         }
     }
 
-    public void addValid(Class<?> beanClass, AccessStrategy accessStategy) {
+    /**
+     * Mark a property of <code>beanClass</code> for nested validation.
+     * @param beanClass
+     * @param accessStrategy defining the property to validate
+     */
+    public void addValid(Class<?> beanClass, AccessStrategy accessStrategy) {
         List<AccessStrategy> slot = validAccesses.get(beanClass);
         if (slot != null) {
-            slot.add(accessStategy);
+            slot.add(accessStrategy);
         } else {
             List<AccessStrategy> tmpList = new ArrayList<AccessStrategy>();
-            tmpList.add(accessStategy);
+            tmpList.add(accessStrategy);
             validAccesses.put(beanClass, tmpList);
         }
     }
 
+    /**
+     * Set the default group sequence for a particular bean class.
+     * @param beanClass
+     * @param groupSequence
+     */
     public void addDefaultSequence(Class<?> beanClass, Class<?>[] groupSequence) {
         defaultSequences.put(beanClass, groupSequence);
     }
 
+    /**
+     * Retrieve the runtime constraint configuration for a given class.
+     * @param <T>
+     * @param beanClass
+     * @return List of {@link MetaConstraint}s applicable to <code>beanClass</code>
+     */
+    @SuppressWarnings("unchecked")
     public <T> List<MetaConstraint<T, ? extends Annotation>> getMetaConstraints(
           Class<T> beanClass) {
         List<MetaConstraint<?,? extends Annotation>> slot = constraintMap.get(beanClass);
@@ -219,15 +304,27 @@ public class ApacheValidatorFactory impl
         }
     }
 
+    /**
+     * Get the {@link AccessStrategy} {@link List} indicating nested bean
+     * validations that must be triggered in the course of validating a
+     * <code>beanClass</code> graph.
+     * @param beanClass
+     * @return {@link List} of {@link AccessStrategy}
+     */
     public List<AccessStrategy> getValidAccesses(Class<?> beanClass) {
         List<AccessStrategy> slot = validAccesses.get(beanClass);
         if (slot != null) {
             return slot;
         } else {
-            return Collections.EMPTY_LIST;
+            return Collections.<AccessStrategy> emptyList();
         }
     }
 
+    /**
+     * Get the default group sequence configured for <code>beanClass</code>.
+     * @param beanClass
+     * @return group Class array
+     */
     public Class<?>[] getDefaultSequence(Class<?> beanClass) {
         return defaultSequences.get(beanClass);
     }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidation.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidation.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidation.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidation.java Fri Jul  9 16:31:15 2010
@@ -19,8 +19,14 @@ package org.apache.bval.jsr303;
 import java.lang.annotation.Annotation;
 
 /**
- * Description: <br/>
+ * Description: unified interface to accumulate {@link ConstraintValidation}s
+ * to varied targets.<br/>
  */
 public interface AppendValidation {
+    /**
+     * Append a {@link ConstraintValidation}.
+     * @param <T>
+     * @param validation
+     */
     <T extends Annotation> void append(ConstraintValidation<T> validation);
 }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToBuilder.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToBuilder.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToBuilder.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToBuilder.java Fri Jul  9 16:31:15 2010
@@ -23,15 +23,22 @@ import java.lang.annotation.Annotation;
 import java.util.Set;
 
 /**
- * Description: <br/>
+ * Description: Adapt {@link AnnotationConstraintBuilder} to the {@link AppendValidation} interface.<br/>
  */
 public class AppendValidationToBuilder extends BaseAppendValidation {
-    private final AnnotationConstraintBuilder builder;
+    private final AnnotationConstraintBuilder<?> builder;
 
-    public AppendValidationToBuilder(AnnotationConstraintBuilder builder) {
+    /**
+     * Create a new AppendValidationToBuilder instance.
+     * @param builder
+     */
+    public AppendValidationToBuilder(AnnotationConstraintBuilder<?> builder) {
         this.builder = builder;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public <T extends Annotation> void preProcessValidation(ConstraintValidation<T> validation) {
         // JSR-303 2.3:
         // Groups from the main constraint annotation are inherited by the composing annotations.
@@ -53,23 +60,28 @@ public class AppendValidationToBuilder e
         T newAnnot = apb.createAnnotation();
         validation.setAnnotation(newAnnot);
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public <T extends Annotation> void performAppend(ConstraintValidation<T> validation) {
         builder.addComposed(validation);
     }
-    
+
     /**
+     * Get inherited groups.
      * @return The set of groups from the parent constraint.
      */
     public Set<Class<?>> getInheritedGroups() {
         return builder.getConstraintValidation().getGroups();
     }
-    
+
     /**
+     * Get inherited payload.
      * @return The set of payloads from the parent constraint.
      */
     public Set<Class<? extends Payload>> getInheritedPayload() {
         return builder.getConstraintValidation().getPayload();
     }
-    
+
 }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToMeta.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToMeta.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToMeta.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToMeta.java Fri Jul  9 16:31:15 2010
@@ -21,15 +21,22 @@ import org.apache.bval.model.FeaturesCap
 import java.lang.annotation.Annotation;
 
 /**
- * Description: <br/>
+ * Description: adapt any {@link FeaturesCapable} from the core meta-model to the {@link AppendValidation} interface.<br/>
  */
 public class AppendValidationToMeta extends BaseAppendValidation {
     private final FeaturesCapable feature;
 
+    /**
+     * Create a new AppendValidationToMeta instance.
+     * @param meta
+     */
     public AppendValidationToMeta(FeaturesCapable meta) {
         this.feature = meta;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public <T extends Annotation> void performAppend(ConstraintValidation<T> validation) {
         feature.addValidation(validation);
     }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/BaseAppendValidation.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/BaseAppendValidation.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/BaseAppendValidation.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/BaseAppendValidation.java Fri Jul  9 16:31:15 2010
@@ -29,6 +29,8 @@ import java.lang.annotation.Annotation;
 public abstract class BaseAppendValidation implements AppendValidation {
 
     /**
+     * {@inheritDoc}
+     *
      * Append operation divided in 3 stages: pre & post processing and the
      * "real" append process.
      */

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java Fri Jul  9 16:31:15 2010
@@ -30,11 +30,20 @@ import java.util.HashSet;
 import java.util.Set;
 
 /**
- * Description: <br/>
+ * Description: Implements {@link BeanDescriptor}.<br/>
  */
 public class BeanDescriptorImpl extends ElementDescriptorImpl implements BeanDescriptor {
+    /**
+     * The {@link ApacheFactoryContext} (not) used by this {@link BeanDescriptorImpl} 
+     */
     protected final ApacheFactoryContext factoryContext;
 
+    /**
+     * Create a new BeanDescriptorImpl instance.
+     * @param factoryContext
+     * @param metaBean
+     * @param validations
+     */
     protected BeanDescriptorImpl(ApacheFactoryContext factoryContext, MetaBean metaBean,
                                  Validation[] validations) {
         super(metaBean, metaBean.getBeanClass(), validations);
@@ -105,7 +114,10 @@ public class BeanDescriptorImpl extends 
         return edesc;
     }
 
-    /** return the property descriptors having at least a constraint defined */
+    /**
+     * {@inheritDoc}
+     * @return the property descriptors having at least a constraint defined
+     */
     public Set<PropertyDescriptor> getConstrainedProperties() {
         Set<PropertyDescriptor> validatedProperties = new HashSet<PropertyDescriptor>();
         for (MetaProperty prop : metaBean.getProperties()) {
@@ -117,6 +129,9 @@ public class BeanDescriptorImpl extends 
         return validatedProperties;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "BeanDescriptorImpl{" + "returnType=" + elementClass + '}';
     }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java Fri Jul  9 16:31:15 2010
@@ -32,6 +32,7 @@ import org.apache.bval.model.Features;
 import org.apache.bval.model.MetaBean;
 import org.apache.bval.model.MetaProperty;
 import org.apache.bval.model.ValidationContext;
+import org.apache.bval.model.ValidationListener;
 import org.apache.bval.util.AccessStrategy;
 import org.apache.commons.lang.ClassUtils;
 
@@ -57,14 +58,26 @@ import java.util.Set;
  * <br/>
  */
 public class ClassValidator extends AbstractBeanValidator implements Validator {
+  /**
+   * {@link ApacheFactoryContext} used
+   */
   protected final ApacheFactoryContext factoryContext;
+  /**
+   * {@link GroupsComputer} used
+   */
   protected final GroupsComputer groupsComputer = new GroupsComputer();
 
+  /**
+   * Create a new ClassValidator instance.
+   * @param factoryContext
+   */
   public ClassValidator(ApacheFactoryContext factoryContext) {
     this.factoryContext = factoryContext;
   }
 
   /**
+   * Create a new ClassValidator instance.
+   * @param factory
    * @deprecated provided for backward compatibility
    */
   public ClassValidator(ApacheValidatorFactory factory) {
@@ -72,7 +85,7 @@ public class ClassValidator extends Abst
   }
 
   /**
-   * the metabean finder associated with this validator.
+   * Get the metabean finder associated with this validator.
    *
    * @return a MetaBeanFinder
    * @see org.apache.bval.MetaBeanManagerFactory#getFinder()
@@ -84,6 +97,7 @@ public class ClassValidator extends Abst
   // Validator implementation --------------------------------------------------
   
   /**
+   * {@inheritDoc}
    * Validates all constraints on <code>object</code>.
    * 
    * @param object
@@ -102,9 +116,10 @@ public class ClassValidator extends Abst
    *             during the validation process
    */
   // @Override - not allowed in 1.5 for Interface methods
-  public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groupArray) {
+  @SuppressWarnings("unchecked")
+  public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) {
     if (object == null) throw new IllegalArgumentException("cannot validate null");
-    checkGroups(groupArray);
+    checkGroups(groups);
 
     try {
       
@@ -112,7 +127,7 @@ public class ClassValidator extends Abst
       MetaBean objectMetaBean = factoryContext.getMetaBeanFinder().findForClass(objectClass);
       
       final GroupValidationContext<ConstraintValidationListener<T>> context =
-          createContext(objectMetaBean, object, objectClass, groupArray);
+          createContext(objectMetaBean, object, objectClass, groups);
       final ConstraintValidationListener<T> result = context.getListener();
       final Groups sequence = context.getGroups();
       
@@ -138,8 +153,9 @@ public class ClassValidator extends Abst
       throw unrecoverableValidationError(ex, object);
     }
   }
-  
+
   /**
+   * {@inheritDoc}
    * Validates all constraints placed on the property of <code>object</code>
    * named <code>propertyName</code>.
    * 
@@ -164,6 +180,7 @@ public class ClassValidator extends Abst
    *             during the validation process
    */
   // @Override - not allowed in 1.5 for Interface methods
+  @SuppressWarnings("unchecked")
   public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName,
                                                           Class<?>... groups) {
     if (object == null) throw new IllegalArgumentException("cannot validate null");
@@ -214,6 +231,7 @@ public class ClassValidator extends Abst
   }
 
   /**
+   * {@inheritDoc}
    * Validates all constraints placed on the property named
    * <code>propertyName</code> of the class <code>beanType</code> would the
    * property value be <code>value</code>
@@ -285,6 +303,7 @@ public class ClassValidator extends Abst
   }
   
   /**
+   * {@inheritDoc}
    * Return the descriptor object describing bean constraints.
    * The returned object (and associated objects including
    * <code>ConstraintDescriptor<code>s) are immutable.
@@ -321,6 +340,7 @@ public class ClassValidator extends Abst
   }
   
   /**
+   * {@inheritDoc}
    * Return an instance of the specified type allowing access to
    * provider-specific APIs. If the Bean Validation provider
    * implementation does not support the specified class,
@@ -362,14 +382,15 @@ public class ClassValidator extends Abst
    * <p>
    * Special code is present to manage the {@link Default} group.
    * 
-   * @param ValidationContext
+   * @param validationContext
    *            The current context of this validation call. Must have its
    *            {@link GroupValidationContext#getCurrentGroup()} field set.
    */
+  @SuppressWarnings("unchecked")
   @Override
-  protected void validateBeanNet(ValidationContext vcontext) {
+  protected <VL extends ValidationListener> void validateBeanNet(ValidationContext<VL> validationContext) {
 
-    GroupValidationContext<?> context = (GroupValidationContext<?>) vcontext;
+    GroupValidationContext<VL> context = (GroupValidationContext<VL>) validationContext;
 
     // If reached a cascaded bean which is null
     if (context.getBean() == null) {
@@ -388,7 +409,7 @@ public class ClassValidator extends Abst
     if (context.getCurrentGroup().isDefault()) {
 
       List<Group> defaultGroups = expandDefaultGroup(context);
-      final ConstraintValidationListener result = (ConstraintValidationListener) context.getListener();
+      final ConstraintValidationListener<VL> result = (ConstraintValidationListener<VL>) context.getListener();
 
       // If the rootBean defines a GroupSequence
       if (defaultGroups.size() > 1) {
@@ -529,7 +550,7 @@ public class ClassValidator extends Abst
    *
    * @return null when no in default group or default group sequence not redefined
    */
-  private List<Group> expandDefaultGroup(GroupValidationContext context) {
+  private List<Group> expandDefaultGroup(GroupValidationContext<?> context) {
     if (context.getCurrentGroup().isDefault()) {
       // mention if metaBean redefines the default group
       List<Group> groupSeq =
@@ -543,7 +564,13 @@ public class ClassValidator extends Abst
     }
   }
 
-  protected RuntimeException unrecoverableValidationError(RuntimeException ex,
+  /**
+   * Generate an unrecoverable validation error
+   * @param ex
+   * @param object
+   * @return a {@link RuntimeException} of the appropriate type
+   */
+  protected static RuntimeException unrecoverableValidationError(RuntimeException ex,
                                                           Object object) {
     if (ex instanceof UnknownPropertyException) {
       // Convert to IllegalArgumentException
@@ -555,7 +582,7 @@ public class ClassValidator extends Abst
     }
   }
 
-  private void validatePropertyInGroup(GroupValidationContext context) {
+  private void validatePropertyInGroup(GroupValidationContext<?> context) {
     Group currentGroup = context.getCurrentGroup();
     List<Group> defaultGroups = expandDefaultGroup(context);
     if (defaultGroups != null) {
@@ -583,7 +610,15 @@ public class ClassValidator extends Abst
     return nested;
   }
 
-
+  /**
+   * Create a {@link GroupValidationContext}.
+   * @param <T>
+   * @param metaBean
+   * @param object
+   * @param objectClass
+   * @param groups
+   * @return {@link GroupValidationContext} instance
+   */
   protected <T> GroupValidationContext<ConstraintValidationListener<T>> createContext(
       MetaBean metaBean, T object, Class<T> objectClass, Class<?>[] groups) {
     ConstraintValidationListener<T> listener = new ConstraintValidationListener<T>(object, objectClass);
@@ -596,12 +631,15 @@ public class ClassValidator extends Abst
     return context;
   }
 
+  /**
+   * Create a {@link BeanDescriptorImpl}
+   * @param metaBean
+   * @return {@link BeanDescriptorImpl} instance
+   */
   protected BeanDescriptorImpl createBeanDescriptor(MetaBean metaBean) {
     return new BeanDescriptorImpl(factoryContext, metaBean, metaBean.getValidations());
   }
 
-
-
   /**
    * Checks that beanType is valid according to spec Section 4.1.1 i. Throws
    * an {@link IllegalArgumentException} if it is not.

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java Fri Jul  9 16:31:15 2010
@@ -24,12 +24,21 @@ import org.apache.bval.jsr303.xml.Valida
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.validation.*;
+import javax.validation.ConstraintValidatorFactory;
+import javax.validation.MessageInterpolator;
+import javax.validation.TraversableResolver;
+import javax.validation.ValidationException;
+import javax.validation.ValidationProviderResolver;
+import javax.validation.ValidatorFactory;
 import javax.validation.spi.BootstrapState;
 import javax.validation.spi.ConfigurationState;
 import javax.validation.spi.ValidationProvider;
 import java.io.InputStream;
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * Description: used to configure apache-validation for jsr303.
@@ -39,12 +48,33 @@ import java.util.*;
  */
 public class ConfigurationImpl implements ApacheValidatorConfiguration, ConfigurationState {
     private static final Log log = LogFactory.getLog(ConfigurationImpl.class);
-    
-    protected final ValidationProvider provider;
+
+    /**
+     * Configured {@link ValidationProvider}
+     */
+    //couldn't this be parameterized <ApacheValidatorConfiguration> or <? super ApacheValidatorConfiguration>?
+    protected final ValidationProvider<?> provider;
+
+    /**
+     * Configured {@link ValidationProviderResolver}
+     */
     protected final ValidationProviderResolver providerResolver;
+
+    /**
+     * Configured {@link ValidationProvider} class
+     */
     protected Class<? extends ValidationProvider<?>> providerClass;
+
+    /**
+     * Configured {@link MessageInterpolator}
+     */
     protected MessageInterpolator messageInterpolator;
+
+    /**
+     * Configured {@link ConstraintValidatorFactory}
+     */
     protected ConstraintValidatorFactory constraintValidatorFactory;
+
     private TraversableResolver traversableResolver;
 
     // BEGIN DEFAULTS
@@ -54,8 +84,13 @@ public class ConfigurationImpl implement
     private boolean prepared = false;
     private final TraversableResolver defaultTraversableResolver =
           new DefaultTraversableResolver();
+
+    /**
+     * Default {@link MessageInterpolator}
+     */
     protected final MessageInterpolator defaultMessageInterpolator =
           new DefaultMessageInterpolator();
+
     private final ConstraintValidatorFactory defaultConstraintValidatorFactory =
           new DefaultConstraintValidatorFactory();
     // END DEFAULTS
@@ -64,7 +99,12 @@ public class ConfigurationImpl implement
     private Map<String, String> properties = new HashMap<String, String>();
     private boolean ignoreXmlConfiguration = false;
 
-    public ConfigurationImpl(BootstrapState aState, ValidationProvider aProvider) {
+    /**
+     * Create a new ConfigurationImpl instance.
+     * @param aState
+     * @param aProvider
+     */
+    public ConfigurationImpl(BootstrapState aState, ValidationProvider<?> aProvider) {
         if (aProvider != null) {
             this.provider = aProvider;
             this.providerResolver = null;
@@ -80,6 +120,9 @@ public class ConfigurationImpl implement
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ApacheValidatorConfiguration traversableResolver(TraversableResolver resolver) {
         traversableResolver = resolver;
         this.prepared = false;
@@ -87,6 +130,7 @@ public class ConfigurationImpl implement
     }
 
     /**
+     * {@inheritDoc}
      * Ignore data from the <i>META-INF/validation.xml</i> file if this
      * method is called.
      *
@@ -98,12 +142,18 @@ public class ConfigurationImpl implement
         return this;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ConfigurationImpl messageInterpolator(MessageInterpolator resolver) {
         this.messageInterpolator = resolver;
         this.prepared = false;
         return this;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ConfigurationImpl constraintValidatorFactory(
           ConstraintValidatorFactory constraintFactory) {
         this.constraintValidatorFactory = constraintFactory;
@@ -112,6 +162,7 @@ public class ConfigurationImpl implement
     }
 
     /**
+     * {@inheritDoc}
      * Add a stream describing constraint mapping in the Bean Validation
      * XML format.
      *
@@ -123,6 +174,7 @@ public class ConfigurationImpl implement
     }
 
     /**
+     * {@inheritDoc}
      * Add a provider specific property. This property is equivalent to
      * XML configuration properties.
      * If we do not know how to handle the property, we silently ignore it.
@@ -135,6 +187,7 @@ public class ConfigurationImpl implement
     }
 
     /**
+     * {@inheritDoc}
      * Return a map of non type-safe custom properties.
      *
      * @return null
@@ -144,6 +197,7 @@ public class ConfigurationImpl implement
     }
 
     /**
+     * {@inheritDoc}
      * Returns true if Configuration.ignoreXMLConfiguration() has been called.
      * In this case, we ignore META-INF/validation.xml
      *
@@ -153,30 +207,46 @@ public class ConfigurationImpl implement
         return ignoreXmlConfiguration;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Set<InputStream> getMappingStreams() {
         return mappingStreams;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public MessageInterpolator getMessageInterpolator() {
         return messageInterpolator;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public MessageInterpolator getDefaultMessageInterpolator() {
         return defaultMessageInterpolator;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public TraversableResolver getDefaultTraversableResolver() {
         return defaultTraversableResolver;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ConstraintValidatorFactory getDefaultConstraintValidatorFactory() {
         return defaultConstraintValidatorFactory;
     }
 
     /**
+     * {@inheritDoc}
      * main factory method to build a ValidatorFactory
      *
-     * @throw ValidationException if the ValidatorFactory cannot be built
+     * @throws ValidationException if the ValidatorFactory cannot be built
      */
     public ValidatorFactory buildValidatorFactory() {
         prepare();
@@ -218,23 +288,31 @@ public class ConfigurationImpl implement
     }
 
     /**
+     * {@inheritDoc}
      * @return the constraint validator factory of this configuration.
      */
     public ConstraintValidatorFactory getConstraintValidatorFactory() {
         return constraintValidatorFactory;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public TraversableResolver getTraversableResolver() {
         return traversableResolver;
     }
 
-    public ValidationProvider getProvider() {
+    /**
+     * Get the configured {@link ValidationProvider}.
+     * @return {@link ValidationProvider}
+     */
+    public ValidationProvider<?> getProvider() {
         return provider;
     }
 
-    private ValidationProvider findProvider() {
+    private ValidationProvider<?> findProvider() {
         if (providerClass != null) {
-            for (ValidationProvider provider : providerResolver
+            for (ValidationProvider<?> provider : providerResolver
                   .getValidationProviders()) {
                 if (providerClass.isAssignableFrom(provider.getClass())) {
                     return provider;
@@ -248,6 +326,10 @@ public class ConfigurationImpl implement
         }
     }
 
+    /**
+     * Set {@link ValidationProvider} class.
+     * @param providerClass
+     */
     public void setProviderClass(Class<? extends ValidationProvider<?>> providerClass) {
         this.providerClass = providerClass;
     }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintCached.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintCached.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintCached.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintCached.java Fri Jul  9 16:31:15 2010
@@ -29,20 +29,36 @@ import java.util.Map;
  */
 public class ConstraintCached {
     private final Map<Class<? extends Annotation>, Class<? extends ConstraintValidator<?, ?>>[]> classes =
-          new HashMap();
+          new HashMap<Class<? extends Annotation>, Class<? extends ConstraintValidator<?,?>>[]>();
 
+    /**
+     * Record the set of validator classes for a given constraint annotation.
+     * @param annotationClass
+     * @param definitionClasses
+     */
     public <A extends Annotation> void putConstraintValidator(Class<A> annotationClass,
-                                                              Class<? extends ConstraintValidator<?, ?>>[] definitionClasses) {
+                                                              Class<? extends ConstraintValidator<A, ?>>[] definitionClasses) {
         classes.put(annotationClass, definitionClasses);
     }
 
+    /**
+     * Learn whether we have cached the validator classes for the requested constraint annotation.
+     * @param annotationClass to look up
+     * @return boolean
+     */
     public boolean containsConstraintValidator(Class<? extends Annotation> annotationClass) {
         return classes.containsKey(annotationClass);
     }
 
-    public <A extends Annotation> Class<? extends ConstraintValidator<?, ?>>[] getConstraintValidators(
+    /**
+     * Get the cached validator classes for the requested constraint annotation.
+     * @param annotationClass to look up
+     * @return array of {@link ConstraintValidator} implementation types
+     */
+    @SuppressWarnings("unchecked")
+    public <A extends Annotation> Class<? extends ConstraintValidator<A, ?>>[] getConstraintValidators(
           Class<A> annotationClass) {
-        return classes.get(annotationClass);
+        return (Class<? extends ConstraintValidator<A, ?>>[]) classes.get(annotationClass);
     }
 
 }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDefaults.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDefaults.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDefaults.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDefaults.java Fri Jul  9 16:31:15 2010
@@ -25,33 +25,52 @@ import org.apache.commons.logging.LogFac
 import javax.validation.ConstraintValidator;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.annotation.Annotation;
 import java.security.PrivilegedAction;
 import java.util.*;
 
 /**
- * Description: hold default constraints that are build in the framework.
- * The default constraints are configured in DefaultConstraints.properties.<br/>
+ * Description: Provides access to the default constraints/validator implementation classes built into the framework.
+ * These are configured in DefaultConstraints.properties.<br/>
  */
 public class ConstraintDefaults {
     private static final Log log = LogFactory.getLog(ConstraintDefaults.class);
-    private static final String DEFAULT_CONSTAINTS =
+    private static final String DEFAULT_CONSTRAINTS =
           "org/apache/bval/jsr303/DefaultConstraints.properties";
-    protected Map<String, Class[]> defaultConstraints;
-
+    
+    /**
+     * The default constraint data stored herein.
+     */
+    protected Map<String, Class<? extends ConstraintValidator<?, ?>>[]> defaultConstraints;
+
+    /**
+     * Create a new ConstraintDefaults instance.
+     */
     public ConstraintDefaults() {
-        defaultConstraints = loadDefaultConstraints(DEFAULT_CONSTAINTS);
+        defaultConstraints = loadDefaultConstraints(DEFAULT_CONSTRAINTS);
     }
 
-    public Map<String, Class[]> getDefaultConstraints() {
+    /**
+     * Get the default constraint data.
+     * @return String-keyed map
+     */
+    public Map<String, Class<? extends ConstraintValidator<?, ?>>[]> getDefaultConstraints() {
         return defaultConstraints;
     }
 
-    public Class<? extends ConstraintValidator<?, ?>>[] getValidatorClasses(
-          Class<? extends java.lang.annotation.Annotation> annotationType) {
-        return getDefaultConstraints().get(annotationType.getName());
+    /**
+     * Get the default validator implementation types for the specified constraint annotation type. 
+     * @param annotationType
+     * @return array of {@link ConstraintValidator} implementation classes
+     */
+    @SuppressWarnings("unchecked")
+    public <A extends Annotation> Class<? extends ConstraintValidator<A, ?>>[] getValidatorClasses(
+          Class<A> annotationType) {
+        return (Class<? extends ConstraintValidator<A, ?>>[]) getDefaultConstraints().get(annotationType.getName());
     }
-    
-    private Map<String, Class[]> loadDefaultConstraints(String resource) {
+
+    @SuppressWarnings("unchecked")
+    private Map<String, Class<? extends ConstraintValidator<?, ?>>[]> loadDefaultConstraints(String resource) {
         Properties constraintProperties = new Properties();
         final ClassLoader classloader = getClassLoader();
         InputStream stream = classloader.getResourceAsStream(resource);
@@ -64,7 +83,8 @@ public class ConstraintDefaults {
         } else {
             log.warn("cannot find " + resource);
         }
-        Map<String, Class[]> loadedConstraints = new HashMap();
+        Map<String, Class<? extends ConstraintValidator<?, ?>>[]> loadedConstraints
+                = new HashMap<String, Class<? extends ConstraintValidator<?,?>>[]>();
         for (Map.Entry entry : constraintProperties.entrySet()) {
 
             StringTokenizer tokens = new StringTokenizer((String) entry.getValue(), ", ");

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDescriptorImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDescriptorImpl.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDescriptorImpl.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDescriptorImpl.java Fri Jul  9 16:31:15 2010
@@ -33,6 +33,9 @@ import java.util.Set;
  * Time: 10:21:23<br>
  */
 public class ConstraintDescriptorImpl<T extends Annotation> implements ConstraintDescriptor<T>, Serializable {
+  /** Serialization version */
+  private static final long serialVersionUID = 1L;
+
   private final T annotation;
   private final Set<Class<?>> groups;
   private final Set<Class<? extends javax.validation.Payload>> payload;
@@ -41,12 +44,26 @@ public class ConstraintDescriptorImpl<T 
   private final Set<ConstraintDescriptor<?>> composingConstraints;
   private final boolean reportAsSingleViolation;
 
+  /**
+   * Create a new ConstraintDescriptorImpl instance.
+   * @param descriptor
+   */
   public ConstraintDescriptorImpl(ConstraintDescriptor<T> descriptor) {
     this(descriptor.getAnnotation(), descriptor.getGroups(), descriptor.getPayload(),
         descriptor.getConstraintValidatorClasses(),
         descriptor.getAttributes(), descriptor.getComposingConstraints(), descriptor.isReportAsSingleViolation());
   }
 
+  /**
+   * Create a new ConstraintDescriptorImpl instance.
+   * @param annotation
+   * @param groups
+   * @param payload
+   * @param constraintValidatorClasses
+   * @param attributes
+   * @param composingConstraints
+   * @param reportAsSingleViolation
+   */
   public ConstraintDescriptorImpl(T annotation, Set<Class<?>> groups,
                                   Set<Class<? extends javax.validation.Payload>> payload,
                                   List<java.lang.Class<? extends javax.validation.ConstraintValidator<T, ?>>> constraintValidatorClasses,
@@ -61,30 +78,51 @@ public class ConstraintDescriptorImpl<T 
     this.reportAsSingleViolation = reportAsSingleViolation;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public T getAnnotation() {
     return annotation;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public Set<Class<?>> getGroups() {
     return groups;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public Set<Class<? extends Payload>> getPayload() {
     return payload;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public List<java.lang.Class<? extends javax.validation.ConstraintValidator<T, ?>>> getConstraintValidatorClasses() {
     return constraintValidatorClasses;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public Map<String, Object> getAttributes() {
     return attributes;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public Set<ConstraintDescriptor<?>> getComposingConstraints() {
     return composingConstraints;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public boolean isReportAsSingleViolation() {
     return reportAsSingleViolation;
   }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintFinderImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintFinderImpl.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintFinderImpl.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintFinderImpl.java Fri Jul  9 16:31:15 2010
@@ -22,6 +22,7 @@ package org.apache.bval.jsr303;
 import javax.validation.metadata.ConstraintDescriptor;
 import javax.validation.metadata.ElementDescriptor;
 import javax.validation.metadata.Scope;
+import javax.validation.metadata.ElementDescriptor.ConstraintFinder;
 
 import org.apache.bval.jsr303.groups.Group;
 import org.apache.bval.jsr303.groups.Groups;
@@ -36,29 +37,37 @@ import java.util.List;
 import java.util.Set;
 
 /**
- * Description: Implementation to find constraints.<br/>
+ * Description: Implementation of the fluent {@link ConstraintFinder} interface.<br/>
  */
 final class ConstraintFinderImpl implements ElementDescriptor.ConstraintFinder {
     private final MetaBean metaBean;
     private final Set<Scope> findInScopes;
-    private Set<ConstraintValidation> constraintDescriptors;
+    private Set<ConstraintValidation<?>> constraintDescriptors;
 
-    ConstraintFinderImpl(MetaBean metaBean, Set constraintDescriptors) {
+    /**
+     * Create a new ConstraintFinderImpl instance.
+     * @param metaBean
+     * @param constraintDescriptors
+     */
+    ConstraintFinderImpl(MetaBean metaBean, Set<ConstraintValidation<?>> constraintDescriptors) {
         this.metaBean = metaBean;
         this.constraintDescriptors = constraintDescriptors;
         this.findInScopes = new HashSet<Scope>(Arrays.asList(Scope.values()));
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ElementDescriptor.ConstraintFinder unorderedAndMatchingGroups(Class<?>... groups) {
-        Set<ConstraintValidation> matchingDescriptors =
-              new HashSet<ConstraintValidation>(constraintDescriptors.size());
+        Set<ConstraintValidation<?>> matchingDescriptors =
+              new HashSet<ConstraintValidation<?>>(constraintDescriptors.size());
         Groups groupChain = new GroupsComputer().computeGroups(groups);
         for (Group group : groupChain.getGroups()) {
             if ( group.isDefault() ) {
                 // If group is default, check if it gets redefined
                 List<Group> expandedDefaultGroup = metaBean.getFeature(Jsr303Features.Bean.GROUP_SEQUENCE);
                 for ( Group defaultGroupMember : expandedDefaultGroup ) {
-                    for (ConstraintValidation descriptor : constraintDescriptors) {
+                    for (ConstraintValidation<?> descriptor : constraintDescriptors) {
                         if (isInScope(descriptor) && isInGroup(descriptor, defaultGroupMember)) {
                             matchingDescriptors.add(descriptor);
                         }
@@ -66,7 +75,7 @@ final class ConstraintFinderImpl impleme
                 }
             }
             else {
-                for (ConstraintValidation descriptor : constraintDescriptors) {
+                for (ConstraintValidation<?> descriptor : constraintDescriptors) {
                     if (isInScope(descriptor) && isInGroup(descriptor, group)) {
                         matchingDescriptors.add(descriptor);
                     }
@@ -76,11 +85,14 @@ final class ConstraintFinderImpl impleme
         return thisWith(matchingDescriptors);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ElementDescriptor.ConstraintFinder lookingAt(Scope scope) {
         if (scope.equals(Scope.LOCAL_ELEMENT)) {
             findInScopes.remove(Scope.HIERARCHY);
-            for (Iterator<ConstraintValidation> it = constraintDescriptors.iterator(); it.hasNext(); ) {
-                ConstraintValidation cv = it.next();
+            for (Iterator<ConstraintValidation<?>> it = constraintDescriptors.iterator(); it.hasNext(); ) {
+                ConstraintValidation<?> cv = it.next();
                 if ( cv.getOwner() != metaBean.getBeanClass() ) {
                     it.remove();
                 }
@@ -89,11 +101,14 @@ final class ConstraintFinderImpl impleme
         return this;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ElementDescriptor.ConstraintFinder declaredOn(ElementType... elementTypes) {
-        Set<ConstraintValidation> matchingDescriptors =
-              new HashSet<ConstraintValidation>(constraintDescriptors.size());
+        Set<ConstraintValidation<?>> matchingDescriptors =
+              new HashSet<ConstraintValidation<?>>(constraintDescriptors.size());
         for (ElementType each : elementTypes) {
-            for (ConstraintValidation descriptor : constraintDescriptors) {
+            for (ConstraintValidation<?> descriptor : constraintDescriptors) {
                 if (isInScope(descriptor) && isAtElement(descriptor, each)) {
                     matchingDescriptors.add(descriptor);
                 }
@@ -102,14 +117,14 @@ final class ConstraintFinderImpl impleme
         return thisWith(matchingDescriptors);
     }
 
-    private boolean isAtElement(ConstraintValidation descriptor, ElementType each) {
+    private boolean isAtElement(ConstraintValidation<?> descriptor, ElementType each) {
         return descriptor.getAccess().getElementType() == each;
     }
 
-    private boolean isInScope(ConstraintValidation descriptor) {
+    private boolean isInScope(ConstraintValidation<?> descriptor) {
         if (findInScopes.size() == Scope.values().length) return true; // all scopes
         if (metaBean != null) {
-            Class owner = descriptor.getOwner();
+            Class<?> owner = descriptor.getOwner();
             for (Scope scope : findInScopes) {
                 switch (scope) {
                     case LOCAL_ELEMENT:
@@ -124,21 +139,28 @@ final class ConstraintFinderImpl impleme
         return false;
     }
 
-    private boolean isInGroup(ConstraintValidation descriptor, Group group) {
+    private boolean isInGroup(ConstraintValidation<?> descriptor, Group group) {
         return descriptor.getGroups().contains(group.getGroup());
     }
 
     private ElementDescriptor.ConstraintFinder thisWith(
-          Set<ConstraintValidation> matchingDescriptors) {
+          Set<ConstraintValidation<?>> matchingDescriptors) {
         constraintDescriptors = matchingDescriptors;
         return this;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
     public Set<ConstraintDescriptor<?>> getConstraintDescriptors() {
         //noinspection RedundantCast
         return (Set) constraintDescriptors;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean hasConstraints() {
         return !constraintDescriptors.isEmpty();
     }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java Fri Jul  9 16:31:15 2010
@@ -32,6 +32,8 @@ import javax.validation.ConstraintValida
 import javax.validation.Payload;
 import javax.validation.ValidationException;
 import javax.validation.metadata.ConstraintDescriptor;
+
+import java.io.Serializable;
 import java.lang.annotation.Annotation;
 import java.util.*;
 
@@ -42,7 +44,8 @@ import java.util.*;
 public class ConstraintValidation<T extends Annotation>
     implements Validation, ConstraintDescriptor<T> {
   private static final String ANNOTATION_MESSAGE = "message";
-  private final ConstraintValidator validator;
+
+  private final ConstraintValidator<T, ?> validator;
   private T annotation; // for metadata request API
   private final AccessStrategy access;
   private final boolean reportFromComposite;
@@ -54,23 +57,26 @@ public class ConstraintValidation<T exte
    * the owner is the type where the validation comes from.
    * it is used to support implicit grouping.
    */
-  private final Class owner;
+  private final Class<?> owner;
   private Set<Class<?>> groups;
   private Set<Class<? extends Payload>> payload;
   private Class<? extends ConstraintValidator<T, ?>>[] validatorClasses;
 
   /**
+   * Create a new ConstraintValidation instance.
+   * @param validatorClasses
    * @param validator  - the constraint validator
    * @param annotation - the annotation of the constraint
    * @param owner      - the type where the annotated element is placed
    *                   (class, interface, annotation type)
    * @param access     - how to access the value
+   * @param reportFromComposite
    */
   public ConstraintValidation(
       Class<? extends ConstraintValidator<T, ?>>[] validatorClasses,
-      ConstraintValidator validator, T annotation, Class owner,
+      ConstraintValidator<T, ?> validator, T annotation, Class<?> owner,
       AccessStrategy access, boolean reportFromComposite) {
-    this.attributes = new HashMap();
+    this.attributes = new HashMap<String, Object>();
     this.validatorClasses = validatorClasses;
     this.validator = validator;
     this.annotation = annotation;
@@ -79,36 +85,62 @@ public class ConstraintValidation<T exte
     this.reportFromComposite = reportFromComposite;
   }
 
+  /**
+   * Return a {@link Serializable} {@link ConstraintDescriptor} capturing a snapshot of current state.
+   * @return {@link ConstraintDescriptor}
+   */
   public ConstraintDescriptor<T> asSerializableDescriptor() {
-    return new ConstraintDescriptorImpl(this);
+    return new ConstraintDescriptorImpl<T>(this);
   }
 
+  /**
+   * Set the applicable validation groups.
+   * @param groups
+   */
   void setGroups(Set<Class<?>> groups) {
     this.groups = groups;
     this.attributes.put("groups", groups.toArray(new Class[groups.size()]));
   }
 
+  /**
+   * Set the payload.
+   * @param payload
+   */
   void setPayload(Set<Class<? extends Payload>> payload) {
     this.payload = payload;
     this.attributes.put("payload", payload.toArray(new Class[payload.size()]));
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public boolean isReportAsSingleViolation() {
     return reportFromComposite;
   }
 
-  public void addComposed(ConstraintValidation aConstraintValidation) {
+  /**
+   * Add a composing constraint.
+   * @param aConstraintValidation to add
+   */
+  public void addComposed(ConstraintValidation<?> aConstraintValidation) {
     if (composedConstraints == null) {
-      composedConstraints = new HashSet();
+      composedConstraints = new HashSet<ConstraintValidation<?>>();
     }
     composedConstraints.add(aConstraintValidation);
   }
 
-  public void validate(ValidationContext context) {
-    validate((GroupValidationContext) context);
+  /**
+   * {@inheritDoc}
+   */
+  public <L extends ValidationListener> void validate(ValidationContext<L> context) {
+    validate((GroupValidationContext<L>) context);
   }
 
-  public void validate(GroupValidationContext context) {
+  /**
+   * Validate a {@link GroupValidationContext}.
+   * @param context root
+   */
+  public <L extends ValidationListener> void validate(GroupValidationContext<L> context) {
     context.setConstraintValidation(this);
     /**
      * execute unless the given validation constraint has already been processed
@@ -155,7 +187,7 @@ public class ConstraintValidation<T exte
         return;
       }
     } else {
-      for (ConstraintValidation composed : getComposingValidations()) {
+      for (ConstraintValidation<?> composed : getComposingValidations()) {
         composed.validate(context);
       }
 
@@ -166,7 +198,7 @@ public class ConstraintValidation<T exte
     if (validator != null) {
       ConstraintValidatorContextImpl jsrContext =
           new ConstraintValidatorContextImpl(context, this);
-      if (!validator.isValid(context.getValidatedValue(), jsrContext)) {
+      if (!((ConstraintValidator<T, Object>) validator).isValid(context.getValidatedValue(), jsrContext)) {
         addErrors(context, jsrContext);
       }
     }
@@ -191,7 +223,7 @@ public class ConstraintValidation<T exte
     }
   }
 
-  private boolean isReachable(GroupValidationContext context) {
+  private boolean isReachable(GroupValidationContext<?> context) {
     PathImpl path = context.getPropertyPath();
     NodeImpl node = path.getLeafNode();
     PathImpl beanPath = path.getPathWithoutLeafNode();
@@ -211,68 +243,120 @@ public class ConstraintValidation<T exte
     return true;
   }
 
-  private void addErrors(GroupValidationContext context,
+  private void addErrors(GroupValidationContext<?> context,
                          ConstraintValidatorContextImpl jsrContext) {
     for (ValidationListener.Error each : jsrContext.getErrorMessages()) {
       context.getListener().addError(each, context);
     }
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public String toString() {
     return "ConstraintValidation{" + validator + '}';
   }
 
+  /**
+   * Get the message template used by this constraint.
+   * @return String
+   */
   public String getMessageTemplate() {
     return (String) attributes.get(ANNOTATION_MESSAGE);
   }
 
-  public ConstraintValidator getValidator() {
+  /**
+   * Get the {@link ConstraintValidator} invoked by this {@link ConstraintValidation}.
+   * @return
+   */
+  public ConstraintValidator<T, ?> getValidator() {
     return validator;
   }
 
+  /**
+   * Learn whether this {@link ConstraintValidation} belongs to the specified group.
+   * @param reqGroup
+   * @return boolean
+   */
   protected boolean isMemberOf(Class<?> reqGroup) {
     return groups.contains(reqGroup);
   }
 
-  public Class getOwner() {
+  /**
+   * Get the owning class of this {@link ConstraintValidation}.
+   * @return Class
+   */
+  public Class<?> getOwner() {
     return owner;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public T getAnnotation() {
     return annotation;
   }
 
+  /**
+   * Get the {@link AccessStrategy} used by this {@link ConstraintValidation}.
+   * @return {@link AccessStrategy}
+   */
   public AccessStrategy getAccess() {
     return access;
   }
 
+  /**
+   * Override the Annotation set at construction.
+   * @param annotation
+   */
   public void setAnnotation(T annotation) {
     this.annotation = annotation;
   }
 
   /////////////////////////// ConstraintDescriptor implementation
 
-
+  /**
+   * {@inheritDoc}
+   */
   public Map<String, Object> getAttributes() {
     return attributes;
   }
 
+  /**
+   * {@inheritDoc}
+   */
+  @SuppressWarnings("unchecked")
   public Set<ConstraintDescriptor<?>> getComposingConstraints() {
     return composedConstraints == null ? Collections.EMPTY_SET : composedConstraints;
   }
 
+  /**
+   * Get the composing {@link ConstraintValidation} objects.  This is effectively
+   * an implementation-specific analogue to {@link #getComposingConstraints()}.
+   * @return {@link Set} of {@link ConstraintValidation}
+   */
+  @SuppressWarnings("unchecked")
   Set<ConstraintValidation<?>> getComposingValidations() {
     return composedConstraints == null ? Collections.EMPTY_SET : composedConstraints;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public Set<Class<?>> getGroups() {
     return groups;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public Set<Class<? extends Payload>> getPayload() {
     return payload;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public List<Class<? extends ConstraintValidator<T, ?>>> getConstraintValidatorClasses() {
     if (validatorClasses == null) {
       return Collections.emptyList();

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidationListener.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidationListener.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidationListener.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidationListener.java Fri Jul  9 16:31:15 2010
@@ -30,24 +30,34 @@ import java.util.HashSet;
 import java.util.Set;
 
 /**
- * Description: <br/>
+ * Description: JSR-303 {@link ValidationListener} implementation; provides {@link ConstraintViolation}s.<br/>
  */
 public final class ConstraintValidationListener<T> implements ValidationListener {
-    private final Set<ConstraintViolation<T>> constaintViolations = new HashSet();
+    private final Set<ConstraintViolation<T>> constraintViolations = new HashSet<ConstraintViolation<T>>();
     private final T rootBean;
     private final Class<T> rootBeanType;
 
+    /**
+     * Create a new ConstraintValidationListener instance.
+     * @param aRootBean
+     * @param rootBeanType
+     */
     public ConstraintValidationListener(T aRootBean, Class<T> rootBeanType) {
         this.rootBean = aRootBean;
         this.rootBeanType = rootBeanType;
     }
 
-    @SuppressWarnings({"ManualArrayToCollectionCopy"})
-    public void addError(String reason, ValidationContext context) {
+    /**
+     * {@inheritDoc}
+     */
+    public <VL extends ValidationListener> void addError(String reason, ValidationContext<VL> context) {
         addError(reason, null, context);
     }
 
-    public void addError(Error error, ValidationContext context) {
+    /**
+     * {@inheritDoc}
+     */
+    public <VL extends ValidationListener> void addError(Error error, ValidationContext<VL> context) {
         if (error.getOwner() instanceof Path) {
             addError(error.getReason(), (Path) error.getOwner(), context);
         } else {
@@ -56,13 +66,13 @@ public final class ConstraintValidationL
     }
 
     private void addError(String messageTemplate, Path propPath,
-                          ValidationContext context) {
+                          ValidationContext<?> context) {
         final Object value;
 
-        final ConstraintDescriptor descriptor;
+        final ConstraintDescriptor<?> descriptor;
         final String message;
-        if (context instanceof GroupValidationContext) {
-            GroupValidationContext gcontext = (GroupValidationContext) context;
+        if (context instanceof GroupValidationContext<?>) {
+            GroupValidationContext<?> gcontext = (GroupValidationContext<?>) context;
             value = gcontext.getValidatedValue();
             if (gcontext instanceof MessageInterpolator.Context) {
                 message = gcontext.getMessageResolver()
@@ -85,26 +95,48 @@ public final class ConstraintValidationL
         ElementType elementType = (context.getAccess() != null) ? context.getAccess().getElementType() : null;
         ConstraintViolationImpl<T> ic = new ConstraintViolationImpl<T>(messageTemplate,
               message, rootBean, context.getBean(), propPath, value, descriptor, rootBeanType, elementType);
-        constaintViolations.add(ic);
+        constraintViolations.add(ic);
     }
 
+    /**
+     * Get the {@link ConstraintViolation}s accumulated by this {@link ConstraintValidationListener}.
+     * @return {@link Set} of {@link ConstraintViolation}
+     */
+    //TODO rename method for correct spelling
     public Set<ConstraintViolation<T>> getConstaintViolations() {
-        return constaintViolations;
+        return constraintViolations;
     }
 
+    /**
+     * Learn whether no violations were found. 
+     * @return boolean
+     */
     public boolean isEmpty() {
-        return constaintViolations.isEmpty();
+        return constraintViolations.isEmpty();
     }
 
+    /**
+     * Get the root bean.
+     * @return T
+     */
     public T getRootBean() {
         return rootBean;
     }
 
+    /**
+     * Get the root bean type of this {@link ConstraintValidationListener}.
+     * @return Class<T>
+     */
     public Class<T> getRootBeanType() {
         return rootBeanType;
     }
     
+    /**
+     * Get the count of encountered violations.
+     * @return int
+     */
     public int violationsSize() {
-        return constaintViolations.size();
+        return constraintViolations.size();
     }
+
 }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorContextImpl.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorContextImpl.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorContextImpl.java Fri Jul  9 16:31:15 2010
@@ -24,6 +24,7 @@ import org.apache.bval.jsr303.util.NodeI
 import org.apache.bval.jsr303.util.PathImpl;
 import org.apache.bval.model.ValidationListener;
 
+import javax.validation.ConstraintValidator;
 import javax.validation.ConstraintValidatorContext;
 import javax.validation.Path;
 import javax.validation.ValidationException;
@@ -32,31 +33,46 @@ import java.util.LinkedList;
 import java.util.List;
 
 /**
- * Description: <br/>
+ * Description: Short-lived {@link ConstraintValidatorContext} implementation passed by
+ * a {@link ConstraintValidation} to its adapted {@link ConstraintValidator}. <br/>
  */
 public class ConstraintValidatorContextImpl implements ConstraintValidatorContext {
     private final List<ValidationListener.Error> errorMessages =
           new LinkedList<ValidationListener.Error>();
 
-    private final ConstraintValidation constraintDescriptor;
-    private final GroupValidationContext validationContext;
+    private final ConstraintValidation<?> constraintDescriptor;
+    private final GroupValidationContext<?> validationContext;
 
     private boolean defaultDisabled;
 
-    public ConstraintValidatorContextImpl(GroupValidationContext validationContext,
-                                          ConstraintValidation aConstraintValidation) {
+    /**
+     * Create a new ConstraintValidatorContextImpl instance.
+     * @param validationContext
+     * @param aConstraintValidation
+     */
+    public ConstraintValidatorContextImpl(GroupValidationContext<?> validationContext,
+                                          ConstraintValidation<?> aConstraintValidation) {
         this.validationContext = validationContext;
         this.constraintDescriptor = aConstraintValidation;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void disableDefaultConstraintViolation() {
         defaultDisabled = true;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String getDefaultConstraintMessageTemplate() {
         return constraintDescriptor.getMessageTemplate();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ConstraintViolationBuilder buildConstraintViolationWithTemplate(
           String messageTemplate) {
         return new ConstraintViolationBuilderImpl(this, messageTemplate,
@@ -69,6 +85,12 @@ public class ConstraintValidatorContextI
         private final String messageTemplate;
         private final PathImpl propertyPath;
 
+        /**
+         * Create a new ConstraintViolationBuilderImpl instance.
+         * @param contextImpl
+         * @param template
+         * @param path
+         */
         ConstraintViolationBuilderImpl(ConstraintValidatorContextImpl contextImpl,
                                        String template, PathImpl path) {
             parent = contextImpl;
@@ -76,6 +98,9 @@ public class ConstraintValidatorContextI
             propertyPath = path;
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public NodeBuilderDefinedContext addNode(String name) {
             PathImpl path;
             if (propertyPath.isRootPath()) {
@@ -87,12 +112,19 @@ public class ConstraintValidatorContextI
             return new NodeBuilderDefinedContextImpl(parent, messageTemplate, path);
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public ConstraintValidatorContext addConstraintViolation() {
             parent.addError(messageTemplate, propertyPath);
             return parent;
         }
     }
 
+    /**
+     * Get the queued error messages.
+     * @return List
+     */
     public List<ValidationListener.Error> getErrorMessages() {
         if (defaultDisabled && errorMessages.isEmpty()) {
             throw new ValidationException(
@@ -109,10 +141,19 @@ public class ConstraintValidatorContextI
         return returnedErrorMessages;
     }
 
-    public GroupValidationContext getValidationContext() {
+    /**
+     * Get this {@link ConstraintValidatorContext}'s {@link GroupValidationContext}.
+     * @return {@link GroupValidationContext}
+     */
+    public GroupValidationContext<?> getValidationContext() {
         return validationContext;
     }
 
+    /**
+     * Add an error message to this {@link ConstraintValidatorContext}.
+     * @param messageTemplate
+     * @param propertyPath
+     */
     public void addError(String messageTemplate, Path propertyPath) {
         errorMessages.add(new ValidationListener.Error(messageTemplate, propertyPath, null));
     }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorIdentity.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorIdentity.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorIdentity.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorIdentity.java Fri Jul  9 16:31:15 2010
@@ -41,24 +41,45 @@ final class ConstraintValidatorIdentity 
     private final Path path;
     private final ConstraintValidator<?, ?> constraintValidator;
 
+    /**
+     * Create a new ConstraintValidatorIdentity instance.
+     * @param bean
+     * @param path
+     * @param constraintValidator
+     */
     public ConstraintValidatorIdentity(Object bean, Path path, ConstraintValidator<?, ?> constraintValidator) {
         this.bean = bean;
         this.path = path;
         this.constraintValidator = constraintValidator;
     }
 
+    /**
+     * Get the referenced bean.
+     * @return Object
+     */
     public Object getBean() {
         return bean;
     }
 
+    /**
+     * Get the referenced property {@link Path}.
+     * @return Path
+     */
     public Path getPath() {
         return path;
     }
 
+    /**
+     * Get the associated {@link ConstraintValidator}.
+     * @return {@link ConstraintValidator}
+     */
     public ConstraintValidator<?, ?> getConstraintValidator() {
         return constraintValidator;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public boolean equals(Object obj) {
 
@@ -94,6 +115,9 @@ final class ConstraintValidatorIdentity 
         return true;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public int hashCode() {
         final int prime = 31;

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintViolationImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintViolationImpl.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintViolationImpl.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintViolationImpl.java Fri Jul  9 16:31:15 2010
@@ -27,6 +27,9 @@ import java.lang.annotation.ElementType;
  * From rootBean and propertyPath, it is possible to rebuild the context of the failure
  */
 class ConstraintViolationImpl<T> implements ConstraintViolation<T>, Serializable {
+    /** Serialization version */
+    private static final long serialVersionUID = 1L;
+
     private final String messageTemplate;
     private final String message;
     /** root bean validation was invoked on. */
@@ -37,10 +40,10 @@ class ConstraintViolationImpl<T> impleme
     private final Object value;
     private final Path propertyPath;
     private final ElementType elementType;
-    private final ConstraintDescriptor constraintDescriptor;
+    private final ConstraintDescriptor<?> constraintDescriptor;
     
-
     /**
+     * Create a new ConstraintViolationImpl instance.
      * @param messageTemplate - message reason (raw message) 
      * @param message - interpolated message (locale specific)
      * @param rootBean
@@ -48,10 +51,12 @@ class ConstraintViolationImpl<T> impleme
      * @param propertyPath
      * @param value
      * @param constraintDescriptor
+     * @param rootBeanClass
+     * @param elementType
      */
     public ConstraintViolationImpl(String messageTemplate, String message, T rootBean, Object leafBean,
                                    Path propertyPath, Object value,
-                                   ConstraintDescriptor constraintDescriptor, Class<T> rootBeanClass, ElementType elementType) {
+                                   ConstraintDescriptor<?> constraintDescriptor, Class<T> rootBeanClass, ElementType elementType) {
         this.messageTemplate = messageTemplate;
         this.message = message;
         this.rootBean = rootBean;
@@ -64,53 +69,80 @@ class ConstraintViolationImpl<T> impleme
     }
 
     /**
+     * {@inheritDoc}
      * former name getInterpolatedMessage()
      * @return The interpolated error message for this constraint violation.
-     **/
+     */
     public String getMessage() {
         return message;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String getMessageTemplate() {
         return messageTemplate;
     }
 
-    /** Root bean being validated validated */
+    /**
+     * {@inheritDoc}
+     * @return Root bean being validated
+     */
     public T getRootBean() {
         return rootBean;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Class<T> getRootBeanClass() {
         return rootBeanClass;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getLeafBean() {
         return leafBean;
     }
 
-    /** The value failing to pass the constraint */
+    /**
+     * {@inheritDoc}
+     * @return The value failing to pass the constraint
+     */
     public Object getInvalidValue() {
         return value;
     }
 
     /**
-     * the property path to the value from <code>rootBean</code>
-     * Null if the value is the rootBean itself
+     * {@inheritDoc}
+     * @return the property path to the value from <code>rootBean</code>
+     *         Null if the value is the rootBean itself
      */
     public Path getPropertyPath() {
         return propertyPath;
     }
 
-    public ConstraintDescriptor getConstraintDescriptor() {
+    /**
+     * {@inheritDoc}
+     */
+    public ConstraintDescriptor<?> getConstraintDescriptor() {
         return constraintDescriptor;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public String toString() {
         return "ConstraintViolationImpl{" + "rootBean=" + rootBean + ", propertyPath='" +
               propertyPath + '\'' + ", message='" + message + '\'' + ", leafBean=" +
               leafBean + ", value=" + value + '}';
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -133,6 +165,7 @@ class ConstraintViolationImpl<T> impleme
     }
 
     /**
+     * {@inheritDoc}
      * NOTE: Needed to avoid duplication in the reported violations.
      * 
      * @param   obj   the reference object with which to compare.

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultMessageInterpolator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultMessageInterpolator.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultMessageInterpolator.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultMessageInterpolator.java Fri Jul  9 16:31:15 2010
@@ -52,14 +52,21 @@ public class DefaultMessageInterpolator 
     private final Map<Locale, ResourceBundle> userBundlesMap =
           new ConcurrentHashMap<Locale, ResourceBundle>();
 
-    /** Builtin resource bundles hashed against there locale. */
+    /** Builtin resource bundles hashed against their locale. */
     private final Map<Locale, ResourceBundle> defaultBundlesMap =
           new ConcurrentHashMap<Locale, ResourceBundle>();
 
+    /**
+     * Create a new DefaultMessageInterpolator instance.
+     */
     public DefaultMessageInterpolator() {
         this(null);
     }
 
+    /**
+     * Create a new DefaultMessageInterpolator instance.
+     * @param resourceBundle
+     */
     public DefaultMessageInterpolator(ResourceBundle resourceBundle) {
 
         defaultLocale = Locale.getDefault();
@@ -82,8 +89,7 @@ public class DefaultMessageInterpolator 
     public String interpolate(String message, Context context) {
         // probably no need for caching, but it could be done by parameters since the map
         // is immutable and uniquely built per Validation definition, the comparaison has to be based on == and not equals though
-        return interpolateMessage(message,
-              context.getConstraintDescriptor().getAttributes(), defaultLocale);
+        return interpolate(message, context, defaultLocale);
     }
 
     /** {@inheritDoc} */
@@ -270,6 +276,10 @@ public class DefaultMessageInterpolator 
         return bundle;
     }
 
+    /**
+     * Set the default locale used by this {@link DefaultMessageInterpolator}.
+     * @param locale
+     */
     public void setLocale(Locale locale) {
         defaultLocale = locale;
     }

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultValidationProviderResolver.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultValidationProviderResolver.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultValidationProviderResolver.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultValidationProviderResolver.java Fri Jul  9 16:31:15 2010
@@ -37,14 +37,11 @@ public class DefaultValidationProviderRe
     private static final String SPI_CFG =
         "META-INF/services/javax.validation.spi.ValidationProvider";
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * javax.validation.ValidationProviderResolver#getValidationProviders()
+    /**
+     * {@inheritDoc}
      */
     public List<ValidationProvider<?>> getValidationProviders() {
-        List<ValidationProvider<?>> providers = new ArrayList();
+        List<ValidationProvider<?>> providers = new ArrayList<ValidationProvider<?>>();
         try {
             // get our classloader
             ClassLoader cl = Thread.currentThread().getContextClassLoader();
@@ -66,7 +63,7 @@ public class DefaultValidationProviderRe
                                 // try loading the specified class
                                 final Class<?> provider = cl.loadClass(line);
                                 // create an instance to return
-                                providers.add((ValidationProvider) SecureActions.newInstance(provider));
+                                providers.add((ValidationProvider<?>) SecureActions.newInstance(provider));
                             } catch (ClassNotFoundException e) {
                                 throw new ValidationException("Failed to load provider " +
                                     line + " configured in file " + url, e);



Mime
View raw message