incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romanst...@apache.org
Subject svn commit: r943486 - /incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
Date Wed, 12 May 2010 13:39:41 GMT
Author: romanstumm
Date: Wed May 12 13:39:41 2010
New Revision: 943486

URL: http://svn.apache.org/viewvc?rev=943486&view=rev
Log:
BVAL-39 minor refactoring

Modified:
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java?rev=943486&r1=943485&r2=943486&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
(original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
Wed May 12 13:39:41 2010
@@ -190,8 +190,7 @@ public class Jsr303MetaBeanFactory imple
                 if (!factoryContext.getFactory().getAnnotationIgnores()
                       .isIgnoreAnnotations(field)) {
                     if (metaProperty == null) {
-                        metaProperty = createMetaProperty(field.getName(), field.getType());
-                        metabean.putProperty(metaProperty.getName(), metaProperty);
+                        metaProperty = addMetaProperty(metabean, field.getName(), field.getType());
                         processAnnotations(metaProperty, beanClass, field,
                               new FieldAccess(field),
                               new AppendValidationToMeta(metaProperty));//) {
@@ -216,8 +215,7 @@ public class Jsr303MetaBeanFactory imple
                         // create a property for those methods for which there is not yet
a MetaProperty
                         if (metaProperty == null) {
                             metaProperty =
-                                  createMetaProperty(propName, method.getReturnType());
-                            metabean.putProperty(propName, metaProperty);
+                                  addMetaProperty(metabean, propName, method.getReturnType());
                             processAnnotations(metaProperty, beanClass, method,
                                   new MethodAccess(propName, method),
                                   new AppendValidationToMeta(metaProperty));//) {
@@ -245,10 +243,9 @@ public class Jsr303MetaBeanFactory imple
                 metaProperty =
                       metabean.getProperty(meta.getAccessStrategy().getPropertyName());
                 if (metaProperty == null) {
-                    metaProperty = createMetaProperty(
+                    metaProperty = addMetaProperty(metabean,
                           meta.getAccessStrategy().getPropertyName(),
                           meta.getAccessStrategy().getJavaType());
-                    metabean.putProperty(metaProperty.getName(), metaProperty);
                 }
             }
             Class<? extends ConstraintValidator<?, ?>>[] constraintClasses =
@@ -261,18 +258,18 @@ public class Jsr303MetaBeanFactory imple
             MetaProperty metaProperty = metabean.getProperty(access.getPropertyName());
             if (metaProperty == null) {
                 metaProperty =
-                      createMetaProperty(access.getPropertyName(), access.getJavaType());
-                metabean.putProperty(metaProperty.getName(), metaProperty);
+                      addMetaProperty(metabean, access.getPropertyName(), access.getJavaType());
             }
             processValid(metaProperty, access);
         }
     }
 
-    private MetaProperty createMetaProperty(String propName, Type type) {
+    private MetaProperty addMetaProperty(MetaBean parentMetaBean, String propName, Type type)
{
         MetaProperty metaProperty;
         metaProperty = new MetaProperty();
         metaProperty.setName(propName);
         metaProperty.setType(type);
+        parentMetaBean.putProperty(propName, metaProperty);
         return metaProperty;
     }
 



Mime
View raw message