[jboss-svn-commits] JBoss Common SVN: r2996 - jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Feb 25 03:44:28 EST 2009


Author: alex.loubyansky at jboss.com
Date: 2009-02-25 03:44:28 -0500 (Wed, 25 Feb 2009)
New Revision: 2996

Modified:
   jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/GroupBeanHandler.java
Log:
remove requirement for a group property to be readable

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/GroupBeanHandler.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/GroupBeanHandler.java	2009-02-25 08:02:47 UTC (rev 2995)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/GroupBeanHandler.java	2009-02-25 08:44:28 UTC (rev 2996)
@@ -36,6 +36,14 @@
 /**
  * A GroupBeanHandler.
  * 
+ * Before creating a new instance for the group during unmarshalling, this handler will try to obtain
+ * the current value of the group from the parent object using the property the group is bound to.
+ * If the current group value is not null then it will be returned,
+ * otherwise a new instance will be created. This is necessary to support unordered sequences.
+ * 
+ * If the property for the group is not readable then the step to get the group value will be skipped.
+ * It doesn't have to be a requirement for the property to be readable.
+ * 
  * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
  * @version $Revision: 1.1 $
  */
@@ -67,17 +75,21 @@
          throw new JBossXBRuntimeException("No property mapped for group " + qName + " in bean adapter" + ((BeanAdapter)parent).getValue()
                + ", available: " + ((BeanAdapter) parent).getAvailable());
 
-      Object parentValue = ((BeanAdapter) parent).getValue();
       Object groupValue = null;
-      try
+      PropertyInfo propertyInfo = groupHandler.getPropertyInfo();
+      if(propertyInfo.isReadable())
       {
-         groupValue = ((BeanAdapter) parent).get(groupHandler.getPropertyInfo());
+         Object parentValue = ((BeanAdapter) parent).getValue();
+         try
+         {
+            groupValue = ((BeanAdapter) parent).get(propertyInfo);
+         }
+         catch (Throwable e)
+         {
+            throw new JBossXBRuntimeException("Failed to get group value from parent: parent=" + parentValue
+                  + ", property=" + propertyInfo.getName() + ", qName=" + qName, e);
+         }
       }
-      catch (Throwable e)
-      {
-         throw new JBossXBRuntimeException("Failed to get group value from parent: parent=" + parentValue + ", property="
-               + groupHandler.getPropertyInfo().getName() + ", qName=" + qName, e);
-      }
 
       if(groupValue == null)
          return super.startParticle(parent, qName, particle, attrs, nsCtx);




More information about the jboss-svn-commits mailing list