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 [1/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
Author: carlosvara
Date: Fri Jul  9 16:31:15 2010
New Revision: 962601

URL: http://svn.apache.org/viewvc?rev=962601&view=rev
Log:
BVAL-75: merged patches by Matt Benson

Modified:
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/AbstractBeanValidator.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/DynamicMetaBean.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFactory.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/ValidationResults.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/DynaType.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/Features.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/AccessStrategy.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanValidationVersion.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PrivilegedActions.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationConstraintBuilder.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidationProvider.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidation.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToBuilder.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToMeta.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/BaseAppendValidation.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintCached.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDefaults.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDescriptorImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintFinderImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidationListener.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorContextImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorIdentity.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintViolationImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultMessageInterpolator.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultValidationProviderResolver.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ElementDescriptorImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/GraphBeanIdentity.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/GroupValidationContext.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/GroupValidationContextImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303Features.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/NestedMetaProperty.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/PropertyDescriptorImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/UnknownPropertyException.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/AppendValidationToList.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ConstructorDescriptor.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ConstructorDescriptorImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodBeanDescriptor.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodBeanDescriptorImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodDescriptor.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodDescriptorImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorMetaBeanFactory.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ParameterAccess.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ParameterDescriptor.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ParameterDescriptorImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ProcedureDescriptor.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ReturnAccess.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/Group.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/Groups.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/GroupsComputer.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/CachingRelevant.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/CachingTraversableResolver.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/DefaultTraversableResolver.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/JPATraversableResolver.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/SimpleTraversableResolver.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/EnumerationConverter.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NodeBuilderCustomizableContextImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NodeBuilderDefinedContextImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NodeContextBuilderImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NodeImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/PathImpl.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/SecureActions.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/TypeUtils.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationIgnores.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxy.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/MetaConstraint.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationMappingParser.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/AbstractBeanValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/AbstractBeanValidator.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/AbstractBeanValidator.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/AbstractBeanValidator.java Fri Jul  9 16:31:15 2010
@@ -154,6 +154,7 @@ public abstract class AbstractBeanValida
    *            The validation context, its current bean must implement
    *            {@link Map}.
    */
+  @SuppressWarnings("unchecked")
   protected <VL extends ValidationListener> void validateMapInContext(ValidationContext<VL> context) {
     // jsr303 spec: For Map, the value of each Map.Entry is validated (key is not validated).
     Iterator<Map.Entry<Object, Object>> it = ((Map<Object, Object>) context.getBean()).entrySet().iterator();

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java Fri Jul  9 16:31:15 2010
@@ -16,7 +16,11 @@
  */
 package org.apache.bval;
 
-import org.apache.bval.model.*;
+import org.apache.bval.model.FeaturesCapable;
+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.bval.util.PropertyAccess;
 
@@ -66,34 +70,52 @@ public class BeanValidationContext<T ext
     /** listener notified of validation constraint violations. */
     private T listener;
 
+    /**
+     * Create a new BeanValidationContext instance.
+     * @param listener
+     */
     public BeanValidationContext(T listener) {
         this(listener, new IdentityHashMap());
     }
 
+    /**
+     * Create a new BeanValidationContext instance.
+     * @param listener
+     * @param validatedMap
+     */
     protected BeanValidationContext(T listener, Map validatedMap) {
         this.listener = listener;
         this.validatedObjects = validatedMap;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public T getListener() {
         return listener;
     }
 
+    /**
+     * Set the listener.
+     * @param listener T
+     */
     public void setListener(T listener) {
         this.listener = listener;
     }
 
     /**
-     * add the object to the collection of validated objects to keep
-     * track of them to avoid endless loops during validation.
-     *
-     * @return true when the object was not already validated in this context
+     * {@inheritDoc}
+     * Here, state equates to a given bean reference.
      */
     public boolean collectValidated() {
         return validatedObjects.put(getBean(), Boolean.TRUE) == null;
     }
 
-    /** @return true when the object has already been validated in this context */
+    /**
+     * Learn whether a particular object has been validated.
+     * @param object
+     * @return true when the object has already been validated in this context
+     */
     public boolean isValidated(Object object) {
         return validatedObjects.containsKey(object);
     }
@@ -106,6 +128,9 @@ public class BeanValidationContext<T ext
         validatedObjects.clear();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setBean(Object aBean, MetaBean aMetaBean) {
         bean = aBean;
         metaBean = aMetaBean;
@@ -114,7 +139,7 @@ public class BeanValidationContext<T ext
     }
 
     /**
-     * get the cached value or access it somehow (via field or method)<br>
+     * Get the cached value or access it somehow (via field or method)<br>
      * <b>you should prefer getPropertyValue(AccessStrategy) instead of this method</b>
      *
      * @return the current value of the property accessed by reflection
@@ -130,7 +155,10 @@ public class BeanValidationContext<T ext
         }
     }
 
-    /** get the value by using the given access strategy and cache it */
+    /**
+     * {@inheritDoc}
+     * Caches retrieved value.
+     */
     public Object getPropertyValue(AccessStrategy access)
           throws IllegalArgumentException, IllegalStateException {
         if (propertyValue == UNKNOWN || (this.access != access && !fixed)) {
@@ -141,7 +169,7 @@ public class BeanValidationContext<T ext
     }
 
     /**
-     * convenience method to access metaProperty.name
+     * Convenience method to access metaProperty.name
      *
      * @return null or the name of the current property
      */
@@ -149,25 +177,43 @@ public class BeanValidationContext<T ext
         return metaProperty == null ? null : metaProperty.getName();
     }
 
+    /**
+     * Set the current property value.
+     * @param propertyValue
+     */
     public void setPropertyValue(Object propertyValue) {
         this.propertyValue = propertyValue;
     }
 
+    /**
+     * Set the property value, fixed.
+     * @param value
+     */
     public void setFixedValue(Object value) {
         setPropertyValue(value);
-        fixed = true;
+        setFixed(true);
     }
 
+    /**
+     * Learn whether the current property value is "fixed."
+     * @return boolean
+     */
     public boolean isFixed() {
         return fixed;
     }
 
+    /**
+     * Potentially declare the current property value as being "fixed."
+     * If <code>true</code>, the context will reuse any not-<code>UNKNOWN</code>
+     * propertyValue regardless of the {@link AccessStrategy} by which it is requested.
+     * @param fixed
+     */
     public void setFixed(boolean fixed) {
         this.fixed = fixed;
     }
 
     /**
-     * depending on whether we have a metaProperty or not,
+     * Depending on whether we have a metaProperty or not,
      * this returns the metaProperty or otherwise the metaBean.
      * This is used to have a simple way to request features
      * in the Validation for both bean- and property-level validations.
@@ -179,8 +225,7 @@ public class BeanValidationContext<T ext
     }
 
     /**
-     * drop cached value.
-     * mark the internal cachedValue as UNKNOWN.
+     * Drop cached value, marking the internal cachedValue as <code>UNKNOWN</code>.
      * This forces the BeanValidationContext to recompute the value
      * the next time it is accessed.
      * Use this method inside tests or when the propertyValue has been
@@ -191,54 +236,90 @@ public class BeanValidationContext<T ext
         access = null;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public MetaBean getMetaBean() {
         return metaBean;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getBean() {
         return bean;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public MetaProperty getMetaProperty() {
         return metaProperty;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setMetaBean(MetaBean metaBean) {
         this.metaBean = metaBean;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setBean(Object bean) {
         this.bean = bean;
         unknownValue();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setMetaProperty(MetaProperty metaProperty) {
         this.metaProperty = metaProperty;
         unknownValue();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "BeanValidationContext{ bean=" + bean + ", metaProperty=" + metaProperty +
               ", propertyValue=" + propertyValue + '}';
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void moveDown(MetaProperty prop, AccessStrategy access) {
         setMetaProperty(prop);
         setBean(getPropertyValue(access), prop.getMetaBean());
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void moveUp(Object bean, MetaBean aMetaBean) {
         setBean(bean, aMetaBean); // reset context state
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setCurrentIndex(Integer index) {
         // do nothing
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setCurrentKey(Object key) {
         // do nothing
     }
-    
+
+    /**
+     * {@inheritDoc}
+     */
     public AccessStrategy getAccess() {
         return this.access;
     }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java Fri Jul  9 16:31:15 2010
@@ -36,21 +36,26 @@ public class BeanValidator<T extends Val
   private final MetaBeanFinder metaBeanFinder;
 
   /**
-   * convenience method. Use the global instance of MetaBeanManagerFactory.getFinder().
+   * Create a new BeanValidator instance.
+   * Convenience constructor. Use the global instance of MetaBeanManagerFactory.getFinder().
    */
   public BeanValidator() {
     this(MetaBeanManagerFactory.getFinder());
   }
 
+  /**
+   * Create a new BeanValidator instance.
+   * @param metaBeanFinder
+   */
   public BeanValidator(MetaBeanFinder metaBeanFinder) {
     this.metaBeanFinder = metaBeanFinder;
   }
 
-
   /**
-   * convenience API. validate a root object with all related objects
+   * Convenience API. validate a root object with all related objects
    * with its default metaBean definition.
    *
+   * @param bean
    * @return results - validation results found
    */
   public T validate(Object bean) {
@@ -60,10 +65,11 @@ public class BeanValidator<T extends Val
   }
 
   /**
-   * convenience API. validate a root object with all related objects
+   * Convenience API. validate a root object with all related objects
    * according to the metaBean.
    *
    * @param bean - a single bean or a collection of beans (that share the same metaBean!)
+   * @param metaBean
    * @return results - validation results found
    */
   public T validate(Object bean, MetaBean metaBean) {
@@ -74,7 +80,7 @@ public class BeanValidator<T extends Val
   }
 
   /**
-   * validate the method parameters based on @Validate annotations.
+   * Validate the method parameters based on @Validate annotations.
    * Requirements:
    * Parameter, that are to be validated must be annotated with @Validate
    *
@@ -105,6 +111,11 @@ public class BeanValidator<T extends Val
   }
 
   /**
+   * Determine the metabean for the given object.
+   * @param <VL>
+   * @param validate
+   * @param parameter
+   * @param context
    * @return true when validation should happen, false to skip it
    */
   protected <VL extends ValidationListener> boolean determineMetaBean(Validate validate, Object parameter,
@@ -131,7 +142,10 @@ public class BeanValidator<T extends Val
   /**
    * factory method -
    * overwrite in subclasses
+   * 
+   * @return ValidationListener of the proper type
    */
+  @SuppressWarnings("unchecked")
   protected T createResults() {
     return (T) new ValidationResults();
   }
@@ -139,13 +153,15 @@ public class BeanValidator<T extends Val
   /**
    * factory method -
    * overwrite in subclasses
+   * 
+   * @return ValidationContext parameterized with our listener type
    */
   protected ValidationContext<T> createContext() {
     return new BeanValidationContext<T>(createResults());
   }
 
   /**
-   * convenience API. validate a single property.
+   * Convenience API. validate a single property.
    *
    * @param bean         - the root object
    * @param metaProperty - metadata for the property
@@ -160,6 +176,7 @@ public class BeanValidator<T extends Val
   }
 
   /**
+   * {@inheritDoc}
    * internal validate a bean (=not a collection of beans) and its related beans
    */
   protected <VL extends ValidationListener> void validateBeanNet(ValidationContext<VL> context) {
@@ -171,6 +188,12 @@ public class BeanValidator<T extends Val
     }
   }
 
+  /**
+   * Validate a property of a graph.
+   * @param <VL>
+   * @param context
+   * @param prop
+   */
   protected <VL extends ValidationListener> void validateRelatedBean(ValidationContext<VL> context, MetaProperty prop) {
     AccessStrategy[] access = prop.getFeature(Features.Property.REF_CASCADE);
     if (access == null && prop.getMetaBean() != null) { // single property access strategy
@@ -197,7 +220,7 @@ public class BeanValidator<T extends Val
   }
 
   /**
-   * the metabean finder associated with this validator.
+   * Get the metabean finder associated with this validator.
    *
    * @return a MetaBeanFinder
    * @see org.apache.bval.MetaBeanManagerFactory#getFinder()

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/DynamicMetaBean.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/DynamicMetaBean.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/DynamicMetaBean.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/DynamicMetaBean.java Fri Jul  9 16:31:15 2010
@@ -19,18 +19,23 @@ package org.apache.bval;
 import org.apache.bval.model.MetaBean;
 
 /**
- * Description: <br/>
+ * Description: Dynamic {@link MetaBean} subclass.<br/>
  */
 final class DynamicMetaBean extends MetaBean {
     private static final long serialVersionUID = 1L;
 
     private final MetaBeanFinder finder;
 
+    /**
+     * Create a new DynamicMetaBean instance.
+     * @param finder
+     */
     public DynamicMetaBean(MetaBeanFinder finder) {
         this.finder = finder;
     }
 
     /**
+     * {@inheritDoc}
      * different strategies with hints to find MetaBean of associated object can
      * be implemented here.
      */

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java Fri Jul  9 16:31:15 2010
@@ -34,6 +34,9 @@ import static org.apache.bval.model.Feat
  */
 public final class IntrospectorMetaBeanFactory implements MetaBeanFactory {
 
+    /**
+     * {@inheritDoc}
+     */
     public void buildMetaBean(MetaBean meta) throws Exception {
         if(meta.getBeanClass() == null) return; // handle only, when local class exists
 
@@ -50,10 +53,14 @@ public final class IntrospectorMetaBeanF
         }
     }
 
+    /**
+     * Create a {@link MetaProperty} from the specified {@link PropertyDescriptor}.
+     * @param pd
+     * @return MetaProperty
+     */
     protected MetaProperty buildMetaProperty(PropertyDescriptor pd) {
         MetaProperty meta = new MetaProperty();
         meta.setName(pd.getName());
-//        meta.setDisplayName(pd.getDisplayName());
         meta.setType(pd.getPropertyType());
         if (pd.isHidden()) meta.putFeature(HIDDEN, Boolean.TRUE);
         if (pd.isPreferred()) meta.putFeature(PREFERRED, Boolean.TRUE);

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java Fri Jul  9 16:31:15 2010
@@ -37,29 +37,49 @@ public class MetaBeanBuilder {
    */
   private MetaBeanFactory[] factories;
 
-
+  /**
+   * Create a new MetaBeanBuilder instance.
+   */
   public MetaBeanBuilder() {
     this(new MetaBeanFactory[]{new IntrospectorMetaBeanFactory()});
   }
 
+  /**
+   * Create a new MetaBeanBuilder instance.
+   * @param factories
+   */
   public MetaBeanBuilder(MetaBeanFactory[] factories) {
     setFactories(factories);
   }
 
+  /**
+   * Get the configured set of {@link MetaBeanFactory} objects.
+   * @return {@link MetaBeanFactory} array
+   */
   public MetaBeanFactory[] getFactories() {
     return factories;
   }
 
+  /**
+   * Set the array of {@link MetaBeanFactory} instances with which to enrich {@link MetaBean}s.
+   * @param factories
+   */
   public void setFactories(MetaBeanFactory[] factories) {
     this.factories = factories;
   }
 
+  /**
+   * Build a {@link MetaBean} for a given id.
+   * @param beanInfoId
+   * @return MetaBean
+   * @throws Exception if unable to build
+   */
   public MetaBean buildForId(String beanInfoId) throws Exception {
     throw new IllegalArgumentException("MetaBean " + beanInfoId + " not found");
   }
 
 /*
-    *//** convenience method *//*
+    *//* convenience method *//*
     public void addLastFactory(MetaBeanFactory metaBeanFactory) {
         if (factories == null) factories = new MetaBeanFactory[1];
         else {
@@ -73,7 +93,7 @@ public class MetaBeanBuilder {
 
     */
 
-  /**
+  /*
    * convenience method
    *//*
     public void addFirstFactory(MetaBeanFactory metaBeanFactory) {
@@ -87,11 +107,19 @@ public class MetaBeanBuilder {
         updateXmlFactory();
     }*/
 
-
+  /**
+   * Build beans for all known ids.  Default implementation returns an empty map.
+   * @return Map of String : MetaBean
+   */
   public Map<String, MetaBean> buildAll() throws Exception {
     return new HashMap<String, MetaBean>();
   }
 
+  /**
+   * Find the named class.
+   * @param className
+   * @return Class found or null
+   */
   protected Class<?> findLocalClass(String className) {
     if (className != null) {
       try {
@@ -103,6 +131,12 @@ public class MetaBeanBuilder {
     return null;
   }
 
+  /**
+   * Build a MetaBean for the specified class.
+   * @param clazz
+   * @return MetaBean
+   * @throws Exception
+   */
   public MetaBean buildForClass(Class<?> clazz) throws Exception {
     MetaBean meta = new MetaBean();
     if (clazz != null) { // local class here?

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java Fri Jul  9 16:31:15 2010
@@ -28,9 +28,18 @@ import java.util.Map;
 public class MetaBeanCache implements MetaBeanFinder, Serializable {
     private static final long serialVersionUID = 1L;
 
+    /**
+     * Cache keyed by id.
+     */
     protected final FastHashMap cacheById;
+    /**
+     * Cache keyed by class.
+     */
     protected final FastHashMap cacheByClass;
 
+    /**
+     * Create a new MetaBeanCache instance.
+     */
     public MetaBeanCache() {
         this.cacheById = new FastHashMap();
         cacheByClass = new FastHashMap();
@@ -38,6 +47,10 @@ public class MetaBeanCache implements Me
         cacheById.setFast(true);
     }
 
+    /**
+     * Create a new MetaBeanCache instance.
+     * @param beans
+     */
     public MetaBeanCache(Map<String, MetaBean> beans) {
         this();
         for (MetaBean bean : beans.values()) {
@@ -45,23 +58,41 @@ public class MetaBeanCache implements Me
         }
     }
 
+    /**
+     * Clear the cache.
+     */
     public void clear() {
         cacheById.clear();
         cacheByClass.clear();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public MetaBean findForId(String beanInfoId) {
         return (MetaBean) cacheById.get(beanInfoId);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public MetaBean findForClass(Class<?> clazz) {
         return (MetaBean) cacheByClass.get(clazz);
     }
 
+    /**
+     * Return all cached MetaBeans by id.
+     * @return live map
+     */
+    @SuppressWarnings("unchecked")
     public Map<String, MetaBean> findAll() {
         return cacheById;
     }
 
+    /**
+     * Cache the specified MetaBean.
+     * @param beanInfo
+     */
     public void cache(MetaBean beanInfo) {
         cacheById.put(beanInfo.getId(), beanInfo);
         if (beanInfo.getBeanClass() != null &&
@@ -70,6 +101,10 @@ public class MetaBeanCache implements Me
         }
     }
 
+    /**
+     * Remove a single MetaBean from the cache.
+     * @param beanInfo
+     */
     public void removeFromCache(MetaBean beanInfo) {
         cacheById.remove(beanInfo.getId());
         if (beanInfo.getBeanClass() != null &&

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFactory.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFactory.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFactory.java Fri Jul  9 16:31:15 2010
@@ -23,5 +23,10 @@ import org.apache.bval.model.MetaBean;
  * with information from somewhere<br/>
  */
 public interface MetaBeanFactory {
-     void buildMetaBean(MetaBean metaBean) throws Exception;
+    /**
+     * Initialize the specified {@link MetaBean}.
+     * @param metaBean
+     * @throws Exception
+     */
+    void buildMetaBean(MetaBean metaBean) throws Exception;
 }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java Fri Jul  9 16:31:15 2010
@@ -24,6 +24,7 @@ import org.apache.bval.model.MetaBean;
  */
 public interface MetaBeanFinder {
     /**
+     * Find a MetaBean with a certain id.
      * @param beanInfoId - symbolic unique name of Meta Info
      * @return BeanInfo
      * @throws IllegalArgumentException - when MetaBean not found
@@ -31,6 +32,7 @@ public interface MetaBeanFinder {
     MetaBean findForId(String beanInfoId);
 
     /**
+     * Find the MetaBean for the specified class.
      * @param clazz - bean class
      * @return BeanInfo (never null)
      */

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java Fri Jul  9 16:31:15 2010
@@ -29,26 +29,47 @@ import static org.apache.bval.model.Feat
  */
 public class MetaBeanManager implements MetaBeanFinder {
 
+  /** MetaBean cache */
   protected final MetaBeanCache cache = new MetaBeanCache();
+  /** MetaBean builder */
   protected final MetaBeanBuilder builder;
+  /** Complete flag */
   protected boolean complete = false;
 
+  /**
+   * Create a new MetaBeanManager instance.
+   */
   public MetaBeanManager() {
     builder = new MetaBeanBuilder();
   }
 
+  /**
+   * Create a new MetaBeanManager instance.
+   * @param builder
+   */
   public MetaBeanManager(MetaBeanBuilder builder) {
     this.builder = builder;
   }
 
+  /**
+   * Get the builder used.
+   * @return {@link MetaBeanBuilder}
+   */
   public MetaBeanBuilder getBuilder() {
     return builder;
   }
 
+  /**
+   * Get the cache used.
+   * @return {@link MetaBeanCache}
+   */
   public MetaBeanCache getCache() {
     return cache;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public MetaBean findForId(String beanInfoId) {
     MetaBean beanInfo = cache.findForId(beanInfoId);
     if (beanInfo != null) return beanInfo;
@@ -65,6 +86,9 @@ public class MetaBeanManager implements 
     }
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public MetaBean findForClass(Class<?> clazz) {
     if (clazz == null) return null;
     MetaBean beanInfo = cache.findForClass(clazz);
@@ -82,6 +106,7 @@ public class MetaBeanManager implements 
   }
 
   /**
+   * Compute all known relationships for <code>beanInfo</code>.
    * must be called AFTER cache.cache()
    * to avoid endless loop
    *
@@ -94,6 +119,11 @@ public class MetaBeanManager implements 
     }
   }
 
+  /**
+   * Compute a single related {@link MetaBean}.
+   * @param prop
+   * @param beanRef
+   */
   protected void computeRelatedMetaBean(MetaProperty prop, String beanRef) {
     Class<?> beanType = prop.getFeature(REF_BEAN_TYPE);
     if (beanType != null) {

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/ValidationResults.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/ValidationResults.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/ValidationResults.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/ValidationResults.java Fri Jul  9 16:31:15 2010
@@ -72,7 +72,13 @@ public class ValidationResults implement
         addError(createError(reason, bean, propertyName), null);
     }
 
-
+    /**
+     * Create an Error object.
+     * @param reason
+     * @param owner
+     * @param propertyName
+     * @return new {@link Error}
+     */
     protected Error createError(String reason, Object owner, String propertyName) {
         return new Error(reason, owner, propertyName);
     }
@@ -86,6 +92,11 @@ public class ValidationResults implement
         errorsByOwner = new LinkedHashMap<Object, Map<String, List<Error>>>();
     }
 
+    /**
+     * Add an Error to the set of Errors shared by a particular "reason."
+     * @param error
+     * @see {@link Error#getReason()}
+     */
     protected void addToReasonBucket(Error error) {
         if (error.getReason() == null) return;
 
@@ -97,6 +108,11 @@ public class ValidationResults implement
         errors.add(error);
     }
 
+    /**
+     * Add an Error to the property-keyed map of Errors maintained for this Error's owner.
+     * @param error
+     * @see {@link Error#getOwner()}
+     */
     protected void addToOwnerBucket(Error error) {
         if (error.getOwner() == null) return;
 
@@ -113,22 +129,31 @@ public class ValidationResults implement
         list.add(error);
     }
 
-    /** key = reason, value = list of errors for this reason */
+    /**
+     * Get the map of Errors by reason; 
+     * key = reason, value = list of errors for this reason
+     * @return map
+     */
     public Map<String, List<Error>> getErrorsByReason() {
         if (errorsByReason == null) return Collections.emptyMap();
         return errorsByReason;
     }
 
     /**
+     * Get the map of Errors by owner;
      * key = owner, value = map with:<br>
      * &nbsp;&nbsp; key = propertyName, value = list of errors for this owner.propertyName
+     * @return map
      */
     public Map<Object, Map<String, List<Error>>> getErrorsByOwner() {
         if (errorsByOwner == null) return Collections.emptyMap();
         return errorsByOwner;
     }
 
-    /** @return true when there are NO errors in this validation result */
+    /**
+     * Learn whether these results are empty/error-free.
+     * @return true when there are NO errors in this validation result
+     */
     public boolean isEmpty() {
         if (errorsByReason == null ||
               (errorsByReason.isEmpty() && errorsByOwner.isEmpty())) return true;
@@ -143,6 +168,12 @@ public class ValidationResults implement
         return true;
     }
 
+    /**
+     * Learn whether there is an Error keyed to a specified reason description.
+     * @param reason
+     * @return boolean
+     * @see {@link Error#getReason()}
+     */
     public boolean hasErrorForReason(String reason) {
         if (errorsByReason == null) return false;
         List<Error> errors = errorsByReason.get(reason);
@@ -150,8 +181,11 @@ public class ValidationResults implement
     }
 
     /**
+     * Learn whether <code>bean</code> has any errors keyed to property <code>propertyName</code>.
+     * @param bean
      * @param propertyName - may be null: any property is checked
      *                     OR the name of the property to check
+     * @return boolean
      */
     public boolean hasError(Object bean, String propertyName) {
         if (errorsByOwner == null) return false;
@@ -168,6 +202,9 @@ public class ValidationResults implement
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "ValidationResults{" + errorsByOwner + "}";
     }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/DynaType.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/DynaType.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/DynaType.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/DynaType.java Fri Jul  9 16:31:15 2010
@@ -23,5 +23,9 @@ import java.lang.reflect.Type;
  * MetaProperty for instance-based types <br/>
  */
 public interface DynaType extends Type {
+    /**
+     * Resolve the type indirection.
+     * @return Type
+     */
     Type getRawType();
 }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java Fri Jul  9 16:31:15 2010
@@ -17,21 +17,34 @@
 package org.apache.bval.model;
 
 /**
- * Description: ("artificial" enum with custom values)<br/>
+ * Description: ("artificial" enum with custom values).<br/>
  */
 public class DynaTypeEnum implements DynaType {
     private final Class<?> enumClass;
     private Value[] enumConstants;
 
+    /**
+     * Create a new DynaTypeEnum instance.
+     * @param enumClass
+     */
     public DynaTypeEnum(Class<?> enumClass) {
         this.enumClass = enumClass;
     }
 
+    /**
+     * Create a new DynaTypeEnum instance.
+     * @param enumClass
+     * @param names
+     */
     public DynaTypeEnum(Class<?> enumClass, String... names) {
-        this.enumClass = enumClass;
+        this(enumClass);
         setEnumNames(names);
     }
 
+    /**
+     * Set the enumeration value names.
+     * @param names
+     */
     public void setEnumNames(String[] names) {
         enumConstants = new Value[names.length];
         int i=0;
@@ -40,15 +53,23 @@ public class DynaTypeEnum implements Dyn
         }
     }
 
+    /**
+     * Get the name of the enum class.
+     * @return String
+     */
     public String getName() {
         return enumClass.getName();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Class<?> getRawType() {
         return enumClass;
     }
 
     /**
+     * Learn whether the referred class is, in fact, an enum class.
      * used by freemarker-template "bean-infos-json.ftl"
      */
     public boolean isEnum() {
@@ -56,29 +77,40 @@ public class DynaTypeEnum implements Dyn
     }
 
     /**
+     * Get the emulated constants.
      * used by freemarker-template "bean-infos-json.ftl"
+     * @return Value[]
      */
     public Value[] getEnumConstants() {
         return enumConstants;
     }
 
+    /**
+     * Learn whether the wrapped class is assignable from <code>cls</code>.
+     * @param cls
+     * @return boolean
+     */
     public boolean isAssignableFrom(Class<?> cls) {
         return enumClass.isAssignableFrom(cls);
     }
 
     /**
-     * represent a single "enum" instance (= the value)
+     * Represents a single "enum" instance (= the value).
      */
     public static final class Value {
         final String name;
 
+        /**
+         * Create a new Value instance.
+         * @param name
+         */
         Value(String name) {
             this.name = name;
         }
 
         /**
          * used by freemarker-template "bean-infos-json.ftl"
-         * @return
+         * @return the name of this constant
          */
         public String name() {
             return name;

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/Features.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/Features.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/Features.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/Features.java Fri Jul  9 16:31:15 2010
@@ -72,7 +72,7 @@ public interface Features {
         String TIME_LAG = "timeLag";
 
         /**
-         * INFO: Boolean, Feld visible?
+         * INFO: Boolean, Field visible?
          *
          * @see java.beans.PropertyDescriptor#isHidden()
          */

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java Fri Jul  9 16:31:15 2010
@@ -17,6 +17,7 @@
 package org.apache.bval.model;
 
 import org.apache.commons.collections.FastHashMap;
+import org.apache.commons.lang.ArrayUtils;
 
 import java.io.Serializable;
 import java.util.Map;
@@ -31,22 +32,50 @@ public abstract class FeaturesCapable im
     /** key = validation id, value = the validation */
     private Validation[] validations = new Validation[0];
 
+    /**
+     * Create a new FeaturesCapable instance.
+     */
     public FeaturesCapable() {
         features.setFast(true);
     }
 
+    /**
+     * Get the (live) map of features.
+     * @return Map<String, Object>
+     */
+    @SuppressWarnings("unchecked")
     public Map<String, Object> getFeatures() {
         return features;
     }
 
+    /**
+     * Set whether to optimize read operations by accessing the
+     * features map in an unsynchronized manner.
+     * @param fast
+     */
     public void optimizeRead(boolean fast) {
         features.setFast(fast);
     }
 
+    /**
+     * Get the specified feature.
+     * @param <T>
+     * @param key
+     * @return T
+     */
+    @SuppressWarnings("unchecked")
     public <T> T getFeature(String key) {
         return (T) features.get(key);
     }
 
+    /**
+     * Get the specified feature, returning <code>defaultValue</code> if undeclared.
+     * @param <T>
+     * @param key
+     * @param defaultValue
+     * @return T
+     */
+    @SuppressWarnings("unchecked")
     public <T> T getFeature(String key, T defaultValue) {
         final T v = (T) features.get(key);
         if (v == null) {
@@ -56,12 +85,22 @@ public abstract class FeaturesCapable im
         }
     }
 
-    /** convenience method. */
+    /**
+     * Convenience method to set a particular feature value.
+     * @param <T>
+     * @param key
+     * @param value
+     */
     public <T> void putFeature(String key, T value) {
         features.put(key, value);
     }
 
-    /** create a deep copy! (copy receiver and copy properties) */
+    /**
+     * Create a deep copy (copy receiver and copy properties).
+     * @param <T>
+     * @return new T instance
+     */
+    @SuppressWarnings("unchecked")
     public <T extends FeaturesCapable> T copy() {
         try {
             T self = (T) clone();
@@ -72,6 +111,11 @@ public abstract class FeaturesCapable im
         }
     }
 
+    /**
+     * Copy this {@link FeaturesCapable} into another {@link FeaturesCapable} instance.
+     * @param <T>
+     * @param target
+     */
     protected <T extends FeaturesCapable> void copyInto(T target) {
         target.features = (FastHashMap) features.clone();
         if (validations != null) {
@@ -79,21 +123,27 @@ public abstract class FeaturesCapable im
         }
     }
 
+    /**
+     * Get any validations set for this {@link FeaturesCapable}.
+     * @return Validation array
+     */
     public Validation[] getValidations() {
         return validations;
     }
 
+    /**
+     * Add a validation to this {@link FeaturesCapable}.
+     * @param validation to add
+     */
     public void addValidation(Validation validation) {
-        if (validations.length == 0) {
-            validations = new Validation[1];
-        } else {
-            Validation[] newvalidations = new Validation[validations.length + 1];
-            System.arraycopy(validations, 0, newvalidations, 0, validations.length);
-            validations = newvalidations;
-        }
-        validations[validations.length - 1] = validation;
+        validations = (Validation[]) ArrayUtils.add(validations, validation);
     }
 
+    /**
+     * Search for an equivalent validation among those configured.
+     * @param aValidation
+     * @return true if found
+     */
     public boolean hasValidation(Validation aValidation) {
         if (validations == null) return false;
         for (Validation validation : validations) {

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaBean.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaBean.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaBean.java Fri Jul  9 16:31:15 2010
@@ -32,38 +32,75 @@ public class MetaBean extends FeaturesCa
     private Class<?> beanClass;
     private MetaProperty[] properties = new MetaProperty[0];
 
+    /**
+     * Get the id.
+     * @return String
+     */
     public String getId() {
         return id;
     }
 
+    /**
+     * Set the id.
+     * @param id the String to set
+     */
     public void setId(String id) {
         this.id = id;
     }
 
+    /**
+     * Get the name.
+     * @return String
+     */
     public String getName() {
         return name;
     }
 
-    public Class<?> getBeanClass() {
-        return beanClass;
-    }
-
+    /**
+     * Set the name.
+     * @param name the String to set
+     */
     public void setName(String name) {
         this.name = name;
     }
 
+    /**
+     * Get the beanClass.
+     * @return Class<?>
+     */
+    public Class<?> getBeanClass() {
+        return beanClass;
+    }
+
+    /**
+     * Set the beanClass.
+     * @param beanClass the Class<?> to set
+     */
     public void setBeanClass(Class<?> beanClass) {
         this.beanClass = beanClass;
     }
 
+    /**
+     * Get the properties.
+     * @return MetaProperty[]
+     */
     public MetaProperty[] getProperties() {
         return properties;
     }
 
+    /**
+     * Set the properties.
+     * @param properties the MetaProperty[] to set
+     */
     public void setProperties(MetaProperty[] properties) {
         this.properties = properties;
     }
 
+    /**
+     * Get the specified {@link MetaProperty}.
+     * @param name
+     * @return MetaProperty found or <code>null</code>
+     */
     public MetaProperty getProperty(String name) {
         for (MetaProperty p : properties) {
             if (name.equals(p.getName())) return p;
@@ -71,7 +108,11 @@ public class MetaBean extends FeaturesCa
         return null;
     }
 
-    /** @return true when at least one of the properties is a relationship */
+    /**
+     * Learn whether any known property is a relationship.
+     * @see MetaProperty#isRelationship()
+     * @return true when at least one of the properties is a relationship
+     */
     public boolean hasRelationships() {
         for (MetaProperty p : properties) {
             if (p.isRelationship()) return true;
@@ -79,6 +120,10 @@ public class MetaBean extends FeaturesCa
         return false;
     }
 
+    /**
+     * Learn whether there are any known properties.
+     * @return boolean
+     */
     public boolean hasProperties() {
         return properties.length > 0;
     }
@@ -106,11 +151,17 @@ public class MetaBean extends FeaturesCa
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "MetaBean{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", beanClass=" +
                 beanClass + '}';
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected <T extends FeaturesCapable> void copyInto(T target) {
         super.copyInto(target);
@@ -123,6 +174,16 @@ public class MetaBean extends FeaturesCa
         }
     }
 
+    /**
+     * <p>If this {@link MetaBean} is compatible with <code>bean</code>, return <code>this</code>, else <code>null</code>.</p><p>
+     * Compatibility is satisfied in one of the following ways:<ul>
+     * <li><code>bean</code> is null</li>
+     * <li><code>bean</code> is an instance of our <code>beanClass</code></li>
+     * <li><code>bean</code> <em>is</em> our <code>beanClass</code> itself</li>
+     * </ul></p>
+     * @param bean
+     * @return <code>this</code> or <code>null</code>
+     */
     public MetaBean resolveMetaBean(Object bean) {
         return bean == null || bean == beanClass || beanClass.isInstance(bean) ? this : null;
     }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java Fri Jul  9 16:31:15 2010
@@ -20,8 +20,8 @@ import java.lang.reflect.ParameterizedTy
 import java.lang.reflect.Type;
 
 /**
- * Description: the meta description of a property of a bean. it supports a map
- * of features and multiple validations<br/>
+ * Description: the meta description of a property of a bean. It supports a map
+ * of features and multiple validations.<br/>
  *
  * @see Validation
  * @see MetaBean
@@ -36,46 +36,79 @@ public class MetaProperty extends Featur
     private MetaBean metaBean;
     private MetaBean parentMetaBean;
 
+    /**
+     * Create a new MetaProperty instance.
+     */
     public MetaProperty() {
     }
 
-    /** the metabean of the target bean (mainly for relationships) */
+    /**
+     * Get the metabean of the target bean (mainly for relationships).
+     * @return MetaBean (may be null).
+     */
     public MetaBean getMetaBean() {
         return metaBean;
     }
 
+    /**
+     * Set the MetaBean of this {@link MetaProperty}.
+     * @param metaBean to set
+     */
     public void setMetaBean(MetaBean metaBean) {
         this.metaBean = metaBean;
     }
 
-  /**
-   * the metabean that owns this property (set by MetaBean.putProperty())
-   */
+    /**
+     * Get the metabean that owns this property (set by MetaBean.putProperty())
+     * @return
+     */
     public MetaBean getParentMetaBean() {
         return parentMetaBean;
     }
 
+    /**
+     * Set the metabean that owns this property (usually called by MetaBean.putProperty())
+     * @param parentMetaBean
+     */
+    //TODO could this be made package-private?
     public void setParentMetaBean(MetaBean parentMetaBean) {
         this.parentMetaBean = parentMetaBean;
-    }    
+    }
 
+    /**
+     * Learn whether this property is considered a relationship.
+     * @return <code>true</code> if it has a MetaBean of its own
+     */
     public boolean isRelationship() {
         return metaBean != null;
     }
 
+    /**
+     * Set the type of this property.
+     * @param type to set
+     */
     public void setType(Type type) {
         this.type = type;
     }
 
+    /**
+     * Get the type of this property.
+     * @return
+     */
     public Type getType() {
         return type;
     }
 
+    /**
+     * Resolve the type of this property to a class.
+     * @return Class, <code>null</code> if cannot be determined
+     */
     public Class<?> getTypeClass() {
         return getTypeClass(type);
     }
 
-    private Class<?> getTypeClass(Type rawType) {
+    //TODO can this handle variables?  Perhaps move TypeUtils up from bval-jsr303
+    private static Class<?> getTypeClass(Type rawType) {
         if (rawType instanceof Class<?>) {
             return (Class<?>) rawType;
         } else if (rawType instanceof ParameterizedType) {
@@ -87,31 +120,60 @@ public class MetaProperty extends Featur
         }
     }
 
+    /**
+     * Get the name of this property.
+     * @return String
+     */
     public String getName() {
         return name;
     }
 
+    /**
+     * Learn whether this property is considered mandatory.
+     * @return <code>true</code> if the <code>MANDATORY</code> feature is set to <code>true</code>.
+     * @see {@link Features.Property#MANDATORY}
+     */
     public boolean isMandatory() {
         return getFeature(MANDATORY, Boolean.FALSE).booleanValue();
     }
 
+    /**
+     * Set this property as being mandatory (or not).
+     * @param mandatory
+     * @see {@link Features.Property#MANDATORY}
+     */
     public void setMandatory(boolean mandatory) {
         putFeature(MANDATORY, Boolean.valueOf(mandatory));
     }
 
+    /**
+     * Get javascript validations of this property.
+     * @return String[]
+     * @deprecated
+     */
     @Deprecated // remove this method?
     public String[] getJavaScriptValidations() {
         return getFeature(JAVASCRIPT_VALIDATION_FUNCTIONS);
     }
 
+    /**
+     * Set the name of this property.
+     * @param name to set
+     */
     public void setName(String name) {
         this.name = name;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public MetaProperty clone() throws CloneNotSupportedException {
         return (MetaProperty) super.clone();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return "MetaProperty{" + "name='" + name + '\'' + ", type=" + type + '}';
     }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java Fri Jul  9 16:31:15 2010
@@ -23,48 +23,113 @@ import org.apache.bval.util.AccessStrate
  * during the validation process<br/>
  */
 public interface ValidationContext<T extends ValidationListener> {
+    /**
+     * Get the property value.
+     * @return {@link Object}
+     */
     Object getPropertyValue();
 
-    /** get the value by using the given access strategy and cache it */
+    /**
+     * Get the value by using the given access strategy.
+     * @param access
+     * @return {@link Object}
+     */
     Object getPropertyValue(AccessStrategy access);
 
+    /**
+     * Get the property name.
+     * @return {@link String}
+     */
     String getPropertyName();
 
+    /**
+     * Get the {@link ValidationListener}.
+     * @return T
+     */
     T getListener();
 
+    /**
+     * Get the bean.
+     * @return {@link Object}
+     */
     Object getBean();
 
+    /**
+     * Get the model meta-bean.
+     * @return {@link MetaBean}
+     */
     MetaBean getMetaBean();
 
+    /**
+     * Set the model meta-bean.
+     * @param metaBean
+     */
     void setMetaBean(MetaBean metaBean);
 
+    /**
+     * Get the model meta-property.
+     * @return {@link MetaProperty}
+     */
     MetaProperty getMetaProperty();
 
+    /**
+     * Set the bean.
+     * @param bean
+     */
     void setBean(Object bean);
 
+    /**
+     * Avoid recursion by recording the current state of this context as having been validated.
+     * <p/>
+     *
+     * @return true when this state had not already been recorded
+     */
     boolean collectValidated();
 
+    /**
+     * Set the current bean/metabean.
+     * @param aBean
+     * @param aMetaBean
+     */
     void setBean(Object aBean, MetaBean aMetaBean);
 
+    /**
+     * Set the current meta-property.
+     * @param metaProperty
+     */
     void setMetaProperty(MetaProperty metaProperty);
 
-    /** step deeper into association at 'prop' */
+    /**
+     * Step deeper into association at 'prop' 
+     * @param prop
+     * @param access
+     */
     void moveDown(MetaProperty prop, AccessStrategy access);
 
-    /** step out from a validation of associated objects. */
+    /**
+     * Step out from a validation of associated objects.
+     * @param bean
+     * @param metaBean
+     */
     void moveUp(Object bean, MetaBean metaBean);
 
     /**
-     * set the index of the object currently validated into the context.
+     * Set the index of the object currently validated into the context.
      * used to create the propertyPath with [index] information for collections.
+     * @param index
      */
     void setCurrentIndex(Integer index);
 
     /**
      * set the key of the object in a map currently validated into the context.
      * used to create the propertyPath with [key] information for maps.
+     * @param key
      */
     void setCurrentKey(Object key);
-    
+
+    /**
+     * Get the current access strategy.
+     * @return {@link AccessStrategy}
+     */
     AccessStrategy getAccess();
 }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java Fri Jul  9 16:31:15 2010
@@ -41,34 +41,58 @@ public interface ValidationListener {
     <T extends ValidationListener> void addError(Error error, ValidationContext<T> context);
 
     /**
-     * an object holding a single validation constraint violation
+     * An object holding a single validation constraint violation
      * found during the validation process.
      */
     public class Error implements Serializable {
         private static final long serialVersionUID = 1L;
 
+        /** Reason */
         final String reason;
+        /** Owner */
         final Object owner;
+        /** Property name*/
         final String propertyName;
 
+        /**
+         * Create a new Error instance.
+         * @param aReason
+         * @param aOwner
+         * @param aPropertyName
+         */
         public Error(String aReason, Object aOwner, String aPropertyName) {
             this.reason = aReason;
             this.owner = aOwner;
             this.propertyName = aPropertyName;
         }
 
+        /**
+         * Get the reason.
+         * @return String
+         */
         public String getReason() {
             return reason;
         }
 
+        /**
+         * Get the owner.
+         * @return Object
+         */
         public Object getOwner() {
             return owner;
         }
 
+        /**
+         * Get the propertyName.
+         * @return String
+         */
         public String getPropertyName() {
             return propertyName;
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public String toString() {
             return "Error{" + "reason='" + reason + '\'' + ", propertyName='" +
                   propertyName + '\'' + '}';

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java Fri Jul  9 16:31:15 2010
@@ -43,12 +43,25 @@ public class EMailValidationUtils {
     );
   }
 
+  /**
+   * Learn whether a given object is a valid email address.
+   * @param value to check
+   * @return <code>true</code> if the validation passes
+   */
   public static boolean isValid(Object value) {
     return isValid(value, DEFAULT_EMAIL_PATTERN);
   }
 
+  /**
+   * Learn whether a particular value matches a given pattern per {@link Matcher#matches()}.
+   * @param value
+   * @param aPattern
+   * @return <code>true</code> if <code>value</code> was a <code>String</code> matching <code>aPattern</code>
+   */
+  //TODO it would seem to make sense to move or reduce the visibility of this method as it is more general than email.
   public static boolean isValid(Object value, Pattern aPattern) {
     if (value == null) return true;
+    //TODO could effortlessly validate any CharSequence
     if (!(value instanceof String)) return false;
     String string = (String) value;
     if (string.length() == 0) return true;

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/AccessStrategy.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/AccessStrategy.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/AccessStrategy.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/AccessStrategy.java Fri Jul  9 16:31:15 2010
@@ -21,20 +21,38 @@ import java.lang.reflect.Type;
 
 /**
  * Description: abstract class to encapsulate different strategies
- * to get the value of a Property.<br/>
+ * to get the value of a Property.  This class is designed such that
+ * subclasses are intended to know internally to which property they refer,
+ * with only the particular target instance being externally required
+ * to calculate the property's value.  One intent of this design is
+ * that the notion of the very definition of a property is abstracted
+ * along with the mechanism for accessing that property.<br/>
  */
 public abstract class AccessStrategy {
     /**
-     * get the value from the given instance.
+     * Get the value from the given instance.
      * @param instance
      * @return the value
      * @throws IllegalArgumentException in case of an error
      */
     public abstract Object get(Object instance);
 
+    /**
+     * Get the Java program {@link ElementType} used by this {@link AccessStrategy}
+     * to determine property values.
+     * @return ElementType
+     */
     public abstract ElementType getElementType();
 
+    /**
+     * Get the type of the property
+     * @return Type
+     */
     public abstract Type getJavaType();
 
+    /**
+     * Get a name representative of this property.
+     * @return String
+     */
     public abstract String getPropertyName();
 }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanValidationVersion.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanValidationVersion.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanValidationVersion.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanValidationVersion.java Fri Jul  9 16:31:15 2010
@@ -18,10 +18,8 @@
  */
 package org.apache.bval.util;
 
-import java.io.File;
 import java.io.InputStream;
 import java.io.IOException;
-import java.security.AccessController;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
@@ -32,13 +30,21 @@ import java.util.StringTokenizer;
  */
 public class BeanValidationVersion {
 
+    /** Project name */
     public static final String PROJECT_NAME = "Apache Bean Validation";
+    /** Unique id of the current project/version/revision */
     public static final String PROJECT_ID;
+    /** Version number */
     public static final String VERSION_NUMBER;
+    /** Major release number */
     public static final int MAJOR_RELEASE;
+    /** Minor release number */
     public static final int MINOR_RELEASE;
+    /** Patch/point release number */
     public static final int PATCH_RELEASE;
+    /** Release status */
     public static final String RELEASE_STATUS;
+    /** Version control revision number */
     public static final String REVISION_NUMBER;
 
     static {
@@ -105,26 +111,49 @@ public class BeanValidationVersion {
         PROJECT_ID = PROJECT_NAME + " " + VERSION_NUMBER + "-r" + REVISION_NUMBER;
     }
 
+    /**
+     * Get the project version number.
+     * @return String
+     */
     public static String getVersion() {
         return VERSION_NUMBER;
     }
 
+    /**
+     * Get the version control revision number.
+     * @return String
+     */
     public static String getRevision() {
         return REVISION_NUMBER;
     }
 
+    /**
+     * Get the project name.
+     * @return String
+     */
     public static String getName() {
         return PROJECT_NAME;
     }
 
+    /**
+     * Get the fully-qualified project id.
+     * @return String
+     */
     public static String getID() {
         return PROJECT_ID;
     }
 
+    /**
+     * Main method of this class that prints the {@link #toString()} to <code>System.out</code>.
+     * @param args ignored
+     */
     public static void main(String [] args) {
         System.out.println(new BeanValidationVersion().toString());
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         StringBuilder buf = new StringBuilder(80 * 40);
         appendBanner(buf);

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java Fri Jul  9 16:31:15 2010
@@ -22,16 +22,16 @@ import java.lang.reflect.Type;
 import java.security.PrivilegedAction;
 
 /**
- * Description: direct field access.<br/>
+ * Description: direct field access strategy.<br/>
  */
 public class FieldAccess extends AccessStrategy {
 
     private final Field field;
 
-    public Type getJavaType() {
-        return field.getGenericType();
-    }
-
+    /**
+     * Create a new FieldAccess instance.
+     * @param field
+     */
     public FieldAccess(Field field) {
         this.field = field;
         if(!field.isAccessible()) {
@@ -39,6 +39,9 @@ public class FieldAccess extends AccessS
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object get(final Object instance) {
         return PrivilegedActions.run(new PrivilegedAction<Object>() {
             public Object run() {
@@ -51,18 +54,37 @@ public class FieldAccess extends AccessS
         });
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ElementType getElementType() {
         return ElementType.FIELD;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Type getJavaType() {
+        return field.getGenericType();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public String getPropertyName() {
         return field.getName();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return field.toString();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object o) {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
@@ -72,6 +94,9 @@ public class FieldAccess extends AccessS
         return field.equals(that.field);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return field.hashCode();
     }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java Fri Jul  9 16:31:15 2010
@@ -30,14 +30,19 @@ public class MethodAccess extends Access
     private final Method method;
     private final String propertyName;
 
-    public Type getJavaType() {
-        return method.getGenericReturnType();
-    }
-
+    /**
+     * Create a new MethodAccess instance.
+     * @param method
+     */
     public MethodAccess(Method method) {
         this(getPropertyName(method), method);
     }
 
+    /**
+     * Create a new MethodAccess instance.
+     * @param propertyName
+     * @param method
+     */
     public MethodAccess(String propertyName, Method method) {
         this.method = method;
         this.propertyName = propertyName;
@@ -72,6 +77,7 @@ public class MethodAccess extends Access
     }
 
     /**
+     * {@inheritDoc}
      * normally the propertyName of the getter method, e.g.<br>
      * method: getName() -> propertyName: name<br>
      * method: isValid() -> propertyName: valid<br>
@@ -80,6 +86,9 @@ public class MethodAccess extends Access
         return propertyName;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object get(final Object instance) {
         return PrivilegedActions.run(new PrivilegedAction<Object>() {
             public Object run() {
@@ -94,14 +103,30 @@ public class MethodAccess extends Access
         });
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public ElementType getElementType() {
         return ElementType.METHOD;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public Type getJavaType() {
+        return method.getGenericReturnType();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public String toString() {
         return method.toString();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals(Object o) {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
@@ -111,6 +136,9 @@ public class MethodAccess extends Access
         return method.equals(that.method);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode() {
         return method.hashCode();
     }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PrivilegedActions.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PrivilegedActions.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PrivilegedActions.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PrivilegedActions.java Fri Jul  9 16:31:15 2010
@@ -67,7 +67,7 @@ public class PrivilegedActions {
     }
 
     /**
-     * create a new instance.
+     * Create a new instance of a specified class.
      *
      * @param cls - the class (no interface, non-abstract, has accessible default no-arg-constructor)
      * @return a new instance
@@ -77,6 +77,18 @@ public class PrivilegedActions {
         return newInstance(cls, IllegalArgumentException.class);
     }
 
+    /**
+     * Create a new instance of a specified class.
+     *
+     * @param <T>
+     * @param <E>
+     * @param cls - the class (no interface, non-abstract, has accessible matching constructor)
+     * @param exception type to rethrow
+     * @param paramTypes
+     * @param values
+     * @return a new instance
+     * @throws E
+     */
     public static <T, E extends RuntimeException> T newInstance(final Class<T> cls,
                                                                 final Class<E> exception,
                                                                 final Class<?>[] paramTypes,
@@ -97,7 +109,7 @@ public class PrivilegedActions {
     }
 
     /**
-     * create a new instance of the class using the default no-arg constructor.
+     * Create a new instance of the class using the default no-arg constructor.
      * perform newInstance() call with AccessController.doPrivileged() if possible.
      *
      * @param cls       - the type to create a new instance from
@@ -137,7 +149,7 @@ public class PrivilegedActions {
     }
 
     /**
-     * perform action with AccessController.doPrivileged() if possible.
+     * Perform action with AccessController.doPrivileged() if possible.
      *
      * @param action - the action to run
      * @return result of running the action

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java Fri Jul  9 16:31:15 2010
@@ -35,11 +35,19 @@ public class PropertyAccess extends Acce
   private final String propertyName;
   private Field rememberField;
 
+  /**
+   * Create a new PropertyAccess instance.
+   * @param clazz
+   * @param propertyName
+   */
   public PropertyAccess(Class<?> clazz, String propertyName) {
     this.beanClass = clazz;
     this.propertyName = propertyName;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public ElementType getElementType() {
     return (rememberField != null) ? ElementType.FIELD : ElementType.METHOD;
   }
@@ -53,15 +61,30 @@ public class PropertyAccess extends Acce
     }
   }
 
+  /**
+   * Get a named property from <code>bean</code>.
+   * @param bean
+   * @param propertyName
+   * @return Object found
+   * @throws InvocationTargetException
+   * @throws NoSuchMethodException
+   * @throws IllegalAccessException
+   */
   public static Object getProperty(Object bean, String propertyName) throws
       InvocationTargetException, NoSuchMethodException, IllegalAccessException {
     return new PropertyAccess(bean.getClass(), propertyName).get(bean);
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public String toString() {
     return "Property{" + beanClass.getName() + '.' + propertyName + '}';
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public Type getJavaType() {
     /*if(Map.class.isAssignableFrom(beanClass)) {
         return beanClass.
@@ -91,10 +114,16 @@ public class PropertyAccess extends Acce
     return Object.class; // unknown type: allow any type??
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public String getPropertyName() {
     return propertyName;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public Object get(Object bean) {
     try {
       if (rememberField != null) {  // cache field of previous access
@@ -143,6 +172,9 @@ public class PropertyAccess extends Acce
     }
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public boolean equals(Object o) {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
@@ -152,6 +184,9 @@ public class PropertyAccess extends Acce
     return beanClass.equals(that.beanClass) && propertyName.equals(that.propertyName);
   }
 
+  /**
+   * {@inheritDoc}
+   */
   public int hashCode() {
     int result;
     result = beanClass.hashCode();

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationConstraintBuilder.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationConstraintBuilder.java?rev=962601&r1=962600&r2=962601&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationConstraintBuilder.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationConstraintBuilder.java Fri Jul  9 16:31:15 2010
@@ -38,21 +38,31 @@ import java.util.*;
  * composite constraint validations by parsing the jsr303-annotations
  * and providing information (e.g. for @OverridesAttributes) <br/>
  */
-final class AnnotationConstraintBuilder {
+final class AnnotationConstraintBuilder<A extends Annotation> {
     private static final Log log = LogFactory.getLog(AnnotationConstraintBuilder.class);
+
+    //TODO extract these to some neutral location; see AnnotationProxyBuilder
     private static final String ANNOTATION_PAYLOAD = "payload";
     private static final String ANNOTATION_GROUPS = "groups";
 
     private final ConstraintValidation<?> constraintValidation;
     private List<ConstraintOverrides> overrides;
 
+    /**
+     * Create a new AnnotationConstraintBuilder instance.
+     * @param validatorClasses
+     * @param constraintValidator
+     * @param annotation
+     * @param owner
+     * @param access
+     */
     public AnnotationConstraintBuilder(
-          Class<? extends ConstraintValidator<?, ?>>[] validatorClasses,
-          ConstraintValidator constraintValidator, Annotation annotation, Class owner,
+          Class<? extends ConstraintValidator<A, ?>>[] validatorClasses,
+          ConstraintValidator<A, ?> constraintValidator, A annotation, Class<?> owner,
           AccessStrategy access) {
         boolean reportFromComposite = annotation != null && annotation.annotationType()
               .isAnnotationPresent(ReportAsSingleViolation.class);
-        constraintValidation = new ConstraintValidation(validatorClasses,
+        constraintValidation = new ConstraintValidation<A>(validatorClasses,
               constraintValidator, annotation, owner, access, reportFromComposite);
         buildFromAnnotation();
     }
@@ -93,8 +103,8 @@ final class AnnotationConstraintBuilder 
           throws IllegalAccessException, InvocationTargetException {
         Object raw = method.invoke(constraintValidation.getAnnotation());
         Class<?>[] garr;
-        if (raw instanceof Class) {
-            garr = new Class<?>[]{(Class) raw};
+        if (raw instanceof Class<?>) {
+            garr = new Class[]{(Class<?>) raw};
         } else if (raw instanceof Class<?>[]) {
             garr = (Class<?>[]) raw;
         } else {
@@ -104,24 +114,29 @@ final class AnnotationConstraintBuilder 
         if (garr == null || garr.length == 0) {
             garr = GroupsComputer.getDefaultGroupArray();
         }
-        constraintValidation.setGroups(new HashSet(Arrays.asList(garr)));
+        constraintValidation.setGroups(new HashSet<Class<?>>(Arrays.asList(garr)));
     }
 
+    @SuppressWarnings("unchecked")
     private void buildPayload(Method method)
           throws IllegalAccessException, InvocationTargetException {
-        Class<Payload>[] payload_raw =
-              (Class<Payload>[]) method.invoke(constraintValidation.getAnnotation());
+        Class<? extends Payload>[] payload_raw =
+              (Class<? extends Payload>[]) method.invoke(constraintValidation.getAnnotation());
+        Set<Class<? extends Payload>> payloadSet;
         if (payload_raw == null) {
-            constraintValidation
-                  .setPayload(Collections.<Class<? extends Payload>>emptySet());
+            payloadSet = Collections.<Class<? extends Payload>>emptySet();
         } else {
-            Set pl = new HashSet(payload_raw.length);
-            pl.addAll(Arrays.asList(payload_raw));
-            constraintValidation.setPayload(pl);
+            payloadSet = new HashSet<Class<? extends Payload>>(payload_raw.length);
+            payloadSet.addAll(Arrays.asList(payload_raw));
         }
+        constraintValidation.setPayload(payloadSet);
     }
 
-    public ConstraintValidation getConstraintValidation() {
+    /**
+     * Get the configured {@link ConstraintValidation}.
+     * @return {@link ConstraintValidation}
+     */
+    public ConstraintValidation<?> getConstraintValidation() {
         return constraintValidation;
     }
 
@@ -129,7 +144,7 @@ final class AnnotationConstraintBuilder 
      * initialize a child composite 'validation' with @OverridesAttribute
      * from 'constraintValidation' and add to composites.
      */
-    public void addComposed(ConstraintValidation composite) {
+    public void addComposed(ConstraintValidation<?> composite) {
         applyOverridesAttributes(composite);
         constraintValidation.addComposed(composite); // add AFTER apply()
     }
@@ -234,10 +249,11 @@ final class AnnotationConstraintBuilder 
                                     int constraintIndex) {
             this.constraintType = constraintType;
             this.constraintIndex = constraintIndex;
-            values = new HashMap();
+            values = new HashMap<String, Object>();
         }
 
-        public void applyOn(ConstraintValidation composite) {
+        @SuppressWarnings("unchecked")
+        private void applyOn(ConstraintValidation<?> composite) {
             // Update the attributes
             composite.getAttributes().putAll(values);
 
@@ -248,7 +264,7 @@ final class AnnotationConstraintBuilder 
                 apb.putValue(key, values.get(key));
             }
             Annotation newAnnot = apb.createAnnotation();
-            composite.setAnnotation(newAnnot);
+            ((ConstraintValidation<Annotation>) composite).setAnnotation(newAnnot);
         }
     }
 }



Mime
View raw message