[seam-commits] Seam SVN: r12824 - in modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml: model and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed May 26 17:41:39 EDT 2010


Author: swd847
Date: 2010-05-26 17:41:38 -0400 (Wed, 26 May 2010)
New Revision: 12824

Modified:
   modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/BeanResult.java
   modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java
Log:
minor refactoring



Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/BeanResult.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/BeanResult.java	2010-05-26 21:41:00 UTC (rev 12823)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/BeanResult.java	2010-05-26 21:41:38 UTC (rev 12824)
@@ -25,11 +25,11 @@
 
 public class BeanResult<X>
 {
-   AnnotatedTypeBuilder<X> builder;
-   Class<X> type;
-   BeanResultType beanType = BeanResultType.ADD;
+   final AnnotatedTypeBuilder<X> builder;
+   final Class<X> type;
+   final BeanResultType beanType;
 
-   public BeanResult(Class<X> type, boolean readAnnotations)
+   public BeanResult(Class<X> type, boolean readAnnotations, BeanResultType beanType)
    {
       this.type = type;
       builder = AnnotatedTypeBuilder.newInstance(type);
@@ -37,6 +37,7 @@
       {
          builder.readAnnotationsFromUnderlyingType();
       }
+      this.beanType = beanType;
    }
 
    public AnnotatedTypeBuilder<X> getBuilder()
@@ -54,9 +55,4 @@
       return beanType;
    }
 
-   public void setBeanType(BeanResultType beanType)
-   {
-      this.beanType = beanType;
-   }
-
 }

Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java	2010-05-26 21:41:00 UTC (rev 12823)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java	2010-05-26 21:41:38 UTC (rev 12824)
@@ -305,27 +305,27 @@
    {
       boolean override = !rb.getChildrenOfType(OverrideXmlItem.class).isEmpty();
       boolean extend = !rb.getChildrenOfType(SpecializesXmlItem.class).isEmpty();
-
-      // if it is an extend we want to read the annotations from the underlying
-      // class
-      BeanResult<?> result = new BeanResult(rb.getJavaClass(), extend);
-      AnnotatedTypeBuilder<?> type = result.getBuilder();
-      // list of constructor arguments
-      List<ParameterXmlItem> constList = new ArrayList<ParameterXmlItem>();
-
+      BeanResultType beanType = BeanResultType.ADD;
       if (override && extend)
       {
          throw new XmlConfigurationException("A bean may not both <override> and <extend> an existing bean", rb.getDocument(), rb.getLineno());
       }
       if (override)
       {
-         result.setBeanType(BeanResultType.OVERRIDE);
+         beanType = BeanResultType.OVERRIDE;
       }
       else if (extend)
       {
-         result.setBeanType(BeanResultType.SPECIALISE);
+         beanType = BeanResultType.SPECIALISE;
       }
 
+      // if it is an extend we want to read the annotations from the underlying
+      // class
+      BeanResult<?> result = new BeanResult(rb.getJavaClass(), extend, beanType);
+      AnnotatedTypeBuilder<?> type = result.getBuilder();
+      // list of constructor arguments
+      List<ParameterXmlItem> constList = new ArrayList<ParameterXmlItem>();
+
       for (AnnotationXmlItem item : rb.getChildrenOfType(AnnotationXmlItem.class))
       {
          Annotation a = createAnnotation(item);



More information about the seam-commits mailing list