[jboss-svn-commits] JBoss Common SVN: r2958 - in jbossxb/trunk/src: main/java/org/jboss/xb/builder and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jan 16 02:49:20 EST 2009


Author: alex.loubyansky at jboss.com
Date: 2009-01-16 02:49:20 -0500 (Fri, 16 Jan 2009)
New Revision: 2958

Added:
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentFalse.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentFalseGroup.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentTrue.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentTrueGroup.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentFalse.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentFalseGroup.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentTrue.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentTrueGroup.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/GroupType.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/GroupWithJBossXmlNsPrefixProperty.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/RootWithGroupWithJBossXmlNsPrefixProperty.java
Removed:
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementFalseApplyToTypeFalse.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementFalseApplyToTypeTrue.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementTrueApplyToTypeFalse.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementTrueApplyToTypeTrue.java
Modified:
   jbossxb/trunk/src/main/java/org/jboss/xb/annotations/JBossXmlNsPrefix.java
   jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/test/JBossXmlNsPrefixUnitTestCase.java
Log:
JBXB-168

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/annotations/JBossXmlNsPrefix.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/annotations/JBossXmlNsPrefix.java	2009-01-14 16:35:18 UTC (rev 2957)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/annotations/JBossXmlNsPrefix.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -56,20 +56,20 @@
    boolean schemaTargetIfNotMapped() default false;
    
    /**
-    * True means the element the property is bound to will be bound to the namespace specified by the prefix.
-    * False means the element will be in the schema's target namespace.
+    * True means the element or model group the property is bound to will be bound to the namespace specified by the prefix.
+    * False means the element or model group will be in the schema's target namespace.
     * 
     * @return
     */
-   boolean applyToElement() default true;
+   boolean applyToComponentQName() default true;
    
    /**
-    * True means the type of the property (with its child elements and their types recursively)
+    * True means the type of the property (including its child elements, their types and model groups recursively)
     * will be bound to the namespace specified by the prefix.
-    * False means the type of the property (with its child elements and their types recursively)
+    * False means the type of the property (including its child elements, their types and model groups recursively)
     * will be bound to the schema's target namespace.
     * 
     * @return
     */
-   boolean applyToType() default true;
+   boolean applyToComponentContent() default true;
 }

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java	2009-01-14 16:35:18 UTC (rev 2957)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -1340,12 +1340,30 @@
          {
             if (trace)
                log.trace("Property " + property.getName() + " is bound to " + xmlModelGroup.kind());
+            
+            String groupNs = defaultNamespace;
+            String overridenDefaultNamespace = defaultNamespace;
+            JBossXmlNsPrefix nsPrefix = property.getUnderlyingAnnotation(JBossXmlNsPrefix.class);
+            if (nsPrefix != null)
+            {
+               String ns = schemaBinding.getNamespace(nsPrefix.prefix());
+               if (ns == null && nsPrefix.schemaTargetIfNotMapped())
+               {
+                  throw new IllegalStateException("Prefix '" + nsPrefix.prefix()
+                        + "' is not mapped to any namespace!");
+               }
+               
+               if(nsPrefix.applyToComponentQName())
+                  groupNs = ns;
+               if(nsPrefix.applyToComponentContent())
+                  defaultNamespace = ns;
+            }
 
-            ModelGroupBinding propertyGroup = null;
             QName groupName = null;
             if (!JBossXmlConstants.DEFAULT.equals(xmlModelGroup.name()))
-               groupName = new QName(xmlModelGroup.name());
+               groupName = new QName(groupNs, xmlModelGroup.name());
 
+            ModelGroupBinding propertyGroup = null;
             if (groupName != null)
                propertyGroup = schemaBinding.getGroup(groupName);
 
@@ -1408,36 +1426,31 @@
 
                   PropertyInfo memberProp = propBeanInfo.getProperty(memberPropName);
                   TypeInfo memberTypeInfo = memberProp.getType();
-                  String memberNamespace = null;
+                  String memberNamespace = defaultNamespace;
 
-                  JBossXmlNsPrefix nsPrefix = memberProp.getUnderlyingAnnotation(JBossXmlNsPrefix.class);
-                  if (nsPrefix != null)
-                  {
-                     memberNamespace = schemaBinding.getNamespace(nsPrefix.prefix());
-                     if (memberNamespace == null && nsPrefix.schemaTargetIfNotMapped())
-                     {
-                        throw new IllegalStateException("Prefix '" + nsPrefix.prefix()
-                              + "' is not mapped to any namespace!");
-                     }
-                  }
-
                   String memberName = null;
                   XmlElement memberXmlElement = memberProp.getUnderlyingAnnotation(XmlElement.class);
                   if (memberXmlElement != null)
                   {
                      if (!XmlElement.DEFAULT.class.equals(memberXmlElement.type()))
-                     {
                         memberTypeInfo = memberTypeInfo.getTypeInfoFactory().getTypeInfo(memberXmlElement.type());
-                     }
-
                      if (memberNamespace == null)
                         memberNamespace = memberXmlElement.namespace();
                      memberName = memberXmlElement.name();
                   }
 
-                  if (memberNamespace == null)
+                  JBossXmlNsPrefix memberPrefix = memberProp.getUnderlyingAnnotation(JBossXmlNsPrefix.class);
+                  String memberOverridenDefaultNamespace = defaultNamespace;
+                  if(memberPrefix != null)
                   {
-                     memberNamespace = defaultNamespace;
+                     String ns = schemaBinding.getNamespace(memberPrefix.prefix());
+                     if (ns == null && memberPrefix.schemaTargetIfNotMapped())
+                        throw new IllegalStateException("Prefix '" + memberPrefix.prefix() + "' is not mapped to any namespace!");
+                        
+                     if(memberPrefix.applyToComponentQName())
+                        memberNamespace = ns;
+                     if(memberPrefix.applyToComponentContent())
+                        defaultNamespace = ns;
                   }
 
                   boolean isCol = false;
@@ -1482,19 +1495,21 @@
                   }
 
                   TypeBinding memberTypeBinding = resolveTypeBinding(memberTypeInfo);
-                  ElementBinding memberElement = createElementBinding(memberTypeInfo, memberTypeBinding, memberQName,
-                        false);
+                  ElementBinding memberElement = createElementBinding(memberTypeInfo, memberTypeBinding, memberQName, false);
                   memberElement.setNillable(true);
                   memberElement.setValueAdapter(valueAdapter);
                   ParticleBinding memberParticle = new ParticleBinding(memberElement, 0, 1, isCol);
                   propertyGroup.addParticle(memberParticle);
 
                   if (trace)
-                     log.trace("added " + memberParticle + " to " + xmlModelGroup.kind() + ", property "
-                           + property.getName());
+                     log.trace("added " + memberParticle + " to " + xmlModelGroup.kind() + ", property " + property.getName());
+                  
+                  defaultNamespace = memberOverridenDefaultNamespace;
                }
             }
 
+            defaultNamespace = overridenDefaultNamespace;
+            
             model.addParticle(new ParticleBinding(propertyGroup));
 
             // model group value handler based on the model group name
@@ -1532,9 +1547,6 @@
       if (elements == null || elements.length == 0)
          elements = new XmlElement[1];
 
-      // for now support just one JBossXmlNsPrefix
-      JBossXmlNsPrefix xmlNsPrefix = property.getUnderlyingAnnotation(JBossXmlNsPrefix.class);
-
       // support for @XmlElementWrapper
       // the wrapping element is ignored in this case
       XmlElementWrapper xmlWrapper = property.getUnderlyingAnnotation(XmlElementWrapper.class);
@@ -1591,6 +1603,8 @@
                localPropertyType = propertyType.getTypeInfoFactory().getTypeInfo(elementType);
          }
 
+         // for now support just one JBossXmlNsPrefix
+         JBossXmlNsPrefix xmlNsPrefix = property.getUnderlyingAnnotation(JBossXmlNsPrefix.class);
          String overridenDefaultNamespace = defaultNamespace;
          if (xmlNsPrefix != null)
          {
@@ -1603,10 +1617,9 @@
                   throw new IllegalStateException("Prefix '" + xmlNsPrefix.prefix() + "' is not mapped to any namespace!");
             }
             
-            if(xmlNsPrefix.applyToElement())
+            if(xmlNsPrefix.applyToComponentQName())
                overrideNamespace = prefixNs;
-
-            if(xmlNsPrefix.applyToType())
+            if(xmlNsPrefix.applyToComponentContent())
                defaultNamespace = prefixNs;
          }
 

Deleted: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementFalseApplyToTypeFalse.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementFalseApplyToTypeFalse.java	2009-01-14 16:35:18 UTC (rev 2957)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementFalseApplyToTypeFalse.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
-
-import javax.xml.bind.annotation.XmlNs;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.xb.annotations.JBossXmlNsPrefix;
-import org.jboss.xb.annotations.JBossXmlSchema;
-
-/**
- * A Root.
- * 
- * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 1.1 $
- */
- at XmlRootElement(name="root")
- at JBossXmlSchema(namespace = "ns.root",
-      xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")},
-      elementFormDefault=XmlNsForm.QUALIFIED)
- at XmlType(propOrder={"child", "rootName"})
-public class ApplyToElementFalseApplyToTypeFalse
-{
-   private String rootName;
-   private Child child;
-   
-   public String getRootName()
-   {
-      return rootName;
-   }
-   
-   public void setRootName(String rootName)
-   {
-      this.rootName = rootName;
-   }
-   
-   @JBossXmlNsPrefix(prefix = "child", applyToElement=false, applyToType=false)
-   public Child getChild()
-   {
-      return child;
-   }
-   
-   public void setChild(Child child)
-   {
-      this.child = child;
-   }
-}

Deleted: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementFalseApplyToTypeTrue.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementFalseApplyToTypeTrue.java	2009-01-14 16:35:18 UTC (rev 2957)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementFalseApplyToTypeTrue.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
-
-import javax.xml.bind.annotation.XmlNs;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.xb.annotations.JBossXmlNsPrefix;
-import org.jboss.xb.annotations.JBossXmlSchema;
-
-/**
- * A Root.
- * 
- * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 1.1 $
- */
- at XmlRootElement(name="root")
- at JBossXmlSchema(namespace = "ns.root",
-      xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")},
-      elementFormDefault=XmlNsForm.QUALIFIED)
- at XmlType(propOrder={"child", "rootName"})
-public class ApplyToElementFalseApplyToTypeTrue
-{
-   private String rootName;
-   private Child child;
-   
-   public String getRootName()
-   {
-      return rootName;
-   }
-   
-   public void setRootName(String rootName)
-   {
-      this.rootName = rootName;
-   }
-   
-   @JBossXmlNsPrefix(prefix = "child", applyToElement=false, applyToType=true)
-   public Child getChild()
-   {
-      return child;
-   }
-   
-   public void setChild(Child child)
-   {
-      this.child = child;
-   }
-}

Deleted: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementTrueApplyToTypeFalse.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementTrueApplyToTypeFalse.java	2009-01-14 16:35:18 UTC (rev 2957)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementTrueApplyToTypeFalse.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
-
-import javax.xml.bind.annotation.XmlNs;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.xb.annotations.JBossXmlNsPrefix;
-import org.jboss.xb.annotations.JBossXmlSchema;
-
-/**
- * A Root.
- * 
- * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 1.1 $
- */
- at XmlRootElement(name="root")
- at JBossXmlSchema(namespace = "ns.root",
-      xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")},
-      elementFormDefault=XmlNsForm.QUALIFIED)
- at XmlType(propOrder={"child", "rootName"})
-public class ApplyToElementTrueApplyToTypeFalse
-{
-   private String rootName;
-   private Child child;
-   
-   public String getRootName()
-   {
-      return rootName;
-   }
-   
-   public void setRootName(String rootName)
-   {
-      this.rootName = rootName;
-   }
-   
-   @JBossXmlNsPrefix(prefix = "child", applyToElement=true, applyToType=false)
-   public Child getChild()
-   {
-      return child;
-   }
-   
-   public void setChild(Child child)
-   {
-      this.child = child;
-   }
-}

Deleted: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementTrueApplyToTypeTrue.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementTrueApplyToTypeTrue.java	2009-01-14 16:35:18 UTC (rev 2957)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ApplyToElementTrueApplyToTypeTrue.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
-
-import javax.xml.bind.annotation.XmlNs;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.jboss.xb.annotations.JBossXmlNsPrefix;
-import org.jboss.xb.annotations.JBossXmlSchema;
-
-/**
- * A Root.
- * 
- * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 1.1 $
- */
- at XmlRootElement(name="root")
- at JBossXmlSchema(namespace = "ns.root",
-      xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")},
-      elementFormDefault=XmlNsForm.QUALIFIED)
-public class ApplyToElementTrueApplyToTypeTrue
-{
-   private Child child;
-   
-   @JBossXmlNsPrefix(prefix = "child", applyToType=true)
-   public Child getChild()
-   {
-      return child;
-   }
-   
-   public void setChild(Child child)
-   {
-      this.child = child;
-   }
-}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentFalse.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentFalse.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentFalse.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlNsPrefix;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * A Root.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlRootElement(name="root")
+ at JBossXmlSchema(namespace = "ns.root",
+      xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")},
+      elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlType(propOrder={"child", "rootName"})
+public class ComponentQNameFalseComponentContentFalse
+{
+   private String rootName;
+   private Child child;
+   
+   public String getRootName()
+   {
+      return rootName;
+   }
+   
+   public void setRootName(String rootName)
+   {
+      this.rootName = rootName;
+   }
+   
+   @JBossXmlNsPrefix(prefix = "child", applyToComponentQName=false, applyToComponentContent=false)
+   public Child getChild()
+   {
+      return child;
+   }
+   
+   public void setChild(Child child)
+   {
+      this.child = child;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentFalseGroup.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentFalseGroup.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentFalseGroup.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlNsPrefix;
+import org.jboss.xb.annotations.JBossXmlSchema;
+import javax.xml.bind.annotation.XmlNs;
+
+/**
+ * A ApplyToElementTrueApplyToTypeTrueGroup.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlRootElement(name="root", namespace="ns")
+ at JBossXmlSchema(namespace="ns", xmlns={@XmlNs(prefix="ns2", namespaceURI = "anotherNs")}, elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlType(propOrder={"group", "id"})
+public class ComponentQNameFalseComponentContentFalseGroup
+{
+   private int id;
+   private GroupType group;
+   
+   public int getId()
+   {
+      return id;
+   }
+   
+   public void setId(int id)
+   {
+      this.id = id;
+   }
+   
+   @JBossXmlNsPrefix(prefix = "ns2", applyToComponentQName=false, applyToComponentContent=false)
+   public GroupType getGroup()
+   {
+      return group;
+   }
+   
+   public void setGroup(GroupType group)
+   {
+      this.group = group;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentTrue.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentTrue.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentTrue.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlNsPrefix;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * A Root.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlRootElement(name="root")
+ at JBossXmlSchema(namespace = "ns.root",
+      xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")},
+      elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlType(propOrder={"child", "rootName"})
+public class ComponentQNameFalseComponentContentTrue
+{
+   private String rootName;
+   private Child child;
+   
+   public String getRootName()
+   {
+      return rootName;
+   }
+   
+   public void setRootName(String rootName)
+   {
+      this.rootName = rootName;
+   }
+   
+   @JBossXmlNsPrefix(prefix = "child", applyToComponentQName=false, applyToComponentContent=true)
+   public Child getChild()
+   {
+      return child;
+   }
+   
+   public void setChild(Child child)
+   {
+      this.child = child;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentTrueGroup.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentTrueGroup.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentTrueGroup.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlNsPrefix;
+import org.jboss.xb.annotations.JBossXmlSchema;
+import javax.xml.bind.annotation.XmlNs;
+
+/**
+ * A ApplyToElementTrueApplyToTypeTrueGroup.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlRootElement(name="root", namespace="ns")
+ at JBossXmlSchema(namespace="ns", xmlns={@XmlNs(prefix="ns2", namespaceURI = "anotherNs")}, elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlType(propOrder={"group", "id"})
+public class ComponentQNameFalseComponentContentTrueGroup
+{
+   private int id;
+   private GroupType group;
+   
+   public int getId()
+   {
+      return id;
+   }
+   
+   public void setId(int id)
+   {
+      this.id = id;
+   }
+
+   @JBossXmlNsPrefix(prefix = "ns2", applyToComponentQName=false, applyToComponentContent=true)
+   public GroupType getGroup()
+   {
+      return group;
+   }
+   
+   public void setGroup(GroupType group)
+   {
+      this.group = group;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentFalse.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentFalse.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentFalse.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlNsPrefix;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * A Root.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlRootElement(name="root")
+ at JBossXmlSchema(namespace = "ns.root",
+      xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")},
+      elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlType(propOrder={"child", "rootName"})
+public class ComponentQNameTrueComponentContentFalse
+{
+   private String rootName;
+   private Child child;
+   
+   public String getRootName()
+   {
+      return rootName;
+   }
+   
+   public void setRootName(String rootName)
+   {
+      this.rootName = rootName;
+   }
+   
+   @JBossXmlNsPrefix(prefix = "child", applyToComponentQName=true, applyToComponentContent=false)
+   public Child getChild()
+   {
+      return child;
+   }
+   
+   public void setChild(Child child)
+   {
+      this.child = child;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentFalseGroup.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentFalseGroup.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentFalseGroup.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlNsPrefix;
+import org.jboss.xb.annotations.JBossXmlSchema;
+import javax.xml.bind.annotation.XmlNs;
+
+/**
+ * A ApplyToElementTrueApplyToTypeTrueGroup.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlRootElement(name="root", namespace="ns")
+ at JBossXmlSchema(namespace="ns", xmlns={@XmlNs(prefix="ns2", namespaceURI = "anotherNs")}, elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlType(propOrder={"group", "id"})
+public class ComponentQNameTrueComponentContentFalseGroup
+{
+   private int id;
+   private GroupType group;
+   
+   public int getId()
+   {
+      return id;
+   }
+   
+   public void setId(int id)
+   {
+      this.id = id;
+   }
+
+   @JBossXmlNsPrefix(prefix = "ns2", applyToComponentQName=true, applyToComponentContent=false)
+   public GroupType getGroup()
+   {
+      return group;
+   }
+   
+   public void setGroup(GroupType group)
+   {
+      this.group = group;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentTrue.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentTrue.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentTrue.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.xb.annotations.JBossXmlNsPrefix;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * A Root.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlRootElement(name="root")
+ at JBossXmlSchema(namespace = "ns.root",
+      xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")},
+      elementFormDefault=XmlNsForm.QUALIFIED)
+public class ComponentQNameTrueComponentContentTrue
+{
+   private Child child;
+   
+   @JBossXmlNsPrefix(prefix = "child", applyToComponentContent=true)
+   public Child getChild()
+   {
+      return child;
+   }
+   
+   public void setChild(Child child)
+   {
+      this.child = child;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentTrueGroup.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentTrueGroup.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentTrueGroup.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlNsPrefix;
+import org.jboss.xb.annotations.JBossXmlSchema;
+import javax.xml.bind.annotation.XmlNs;
+
+/**
+ * A ApplyToElementTrueApplyToTypeTrueGroup.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlRootElement(name="root", namespace="ns")
+ at JBossXmlSchema(namespace="ns", xmlns={@XmlNs(prefix="ns2", namespaceURI = "anotherNs")}, elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlType(propOrder={"group", "id"})
+public class ComponentQNameTrueComponentContentTrueGroup
+{
+   private int id;
+   private GroupType group;
+   
+   public int getId()
+   {
+      return id;
+   }
+   
+   public void setId(int id)
+   {
+      this.id = id;
+   }
+   
+   @JBossXmlNsPrefix(prefix = "ns2", applyToComponentQName=true, applyToComponentContent=true)
+   public GroupType getGroup()
+   {
+      return group;
+   }
+   
+   public void setGroup(GroupType group)
+   {
+      this.group = group;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/GroupType.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/GroupType.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/GroupType.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import org.jboss.xb.annotations.JBossXmlModelGroup;
+
+/**
+ * A GroupType.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at JBossXmlModelGroup(name="group", propOrder={"count", "text"})
+public class GroupType
+{
+   private String text;
+   private int count;
+   
+   public String getText()
+   {
+      return text;
+   }
+   
+   public void setText(String text)
+   {
+      this.text = text;
+   }
+   
+   public int getCount()
+   {
+      return count;
+   }
+   
+   public void setCount(int count)
+   {
+      this.count = count;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/GroupWithJBossXmlNsPrefixProperty.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/GroupWithJBossXmlNsPrefixProperty.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/GroupWithJBossXmlNsPrefixProperty.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import org.jboss.xb.annotations.JBossXmlModelGroup;
+import org.jboss.xb.annotations.JBossXmlNsPrefix;
+
+/**
+ * A GroupWithJBossXmlNsPrefixProperty.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at JBossXmlModelGroup(name="group", propOrder={"applyToGroupTrueApplyToContentFalse", "applyToGroupFalseApplyToContentFalse",
+      "applyToGroupTrueApplyToContentTrue", "applyToGroupFalseApplyToContentTrue"})
+public class GroupWithJBossXmlNsPrefixProperty
+{
+   private Child1 applyToGroupTrueApplyToContentFalse;
+   private Child2 applyToGroupFalseApplyToContentFalse;
+   private Child3 applyToGroupTrueApplyToContentTrue;
+   private Child4 applyToGroupFalseApplyToContentTrue;
+   
+   @XmlElement(name="group-true-content-false")
+   @JBossXmlNsPrefix(prefix="child", applyToComponentQName=true, applyToComponentContent=false)
+   public Child1 getApplyToGroupTrueApplyToContentFalse()
+   {
+      return applyToGroupTrueApplyToContentFalse;
+   }
+   public void setApplyToGroupTrueApplyToContentFalse(Child1 ApplyToGroupTrueApplyToContentFalse)
+   {
+      this.applyToGroupTrueApplyToContentFalse = ApplyToGroupTrueApplyToContentFalse;
+   }
+   
+   @XmlElement(name="group-false-content-false")
+   @JBossXmlNsPrefix(prefix="child", applyToComponentQName=false, applyToComponentContent=false)
+   public Child2 getApplyToGroupFalseApplyToContentFalse()
+   {
+      return applyToGroupFalseApplyToContentFalse;
+   }
+   
+   public void setApplyToGroupFalseApplyToContentFalse(Child2 applyToElementFalseApplyToTypeFalse)
+   {
+      this.applyToGroupFalseApplyToContentFalse = applyToElementFalseApplyToTypeFalse;
+   }
+
+   @XmlElement(name="group-true-content-true")
+   @JBossXmlNsPrefix(prefix="child", applyToComponentQName=true, applyToComponentContent=true)
+   public Child3 getApplyToGroupTrueApplyToContentTrue()
+   {
+      return applyToGroupTrueApplyToContentTrue;
+   }
+   
+   public void setApplyToGroupTrueApplyToContentTrue(Child3 ApplyToGroupTrueApplyToContentTrue)
+   {
+      this.applyToGroupTrueApplyToContentTrue = ApplyToGroupTrueApplyToContentTrue;
+   }
+
+   @XmlElement(name="group-false-content-true")
+   @JBossXmlNsPrefix(prefix="child", applyToComponentQName=false, applyToComponentContent=true)
+   public Child4 getApplyToGroupFalseApplyToContentTrue()
+   {
+      return applyToGroupFalseApplyToContentTrue;
+   }
+   
+   public void setApplyToGroupFalseApplyToContentTrue(Child4 ApplyToGroupFalseApplyToContentTrue)
+   {
+      this.applyToGroupFalseApplyToContentTrue = ApplyToGroupFalseApplyToContentTrue;
+   }
+   
+   public static final class Child1 extends Child {}
+   public static final class Child2 extends Child {}
+   public static final class Child3 extends Child {}
+   public static final class Child4 extends Child {}
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/RootWithGroupWithJBossXmlNsPrefixProperty.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/RootWithGroupWithJBossXmlNsPrefixProperty.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/RootWithGroupWithJBossXmlNsPrefixProperty.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * A RootWithGroupWithJBossXmlNsPrefixProperty.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlRootElement(name="root", namespace="ns")
+ at JBossXmlSchema(namespace="ns", xmlns={@XmlNs(prefix="child", namespaceURI = "childNs")}, elementFormDefault=XmlNsForm.QUALIFIED)
+public class RootWithGroupWithJBossXmlNsPrefixProperty
+{
+   private GroupWithJBossXmlNsPrefixProperty group;
+
+   public GroupWithJBossXmlNsPrefixProperty getGroup()
+   {
+      return group;
+   }
+
+   public void setGroup(GroupWithJBossXmlNsPrefixProperty group)
+   {
+      this.group = group;
+   }
+}

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/test/JBossXmlNsPrefixUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/test/JBossXmlNsPrefixUnitTestCase.java	2009-01-14 16:35:18 UTC (rev 2957)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/test/JBossXmlNsPrefixUnitTestCase.java	2009-01-16 07:49:20 UTC (rev 2958)
@@ -27,12 +27,17 @@
 import javax.xml.namespace.QName;
 
 import org.jboss.test.xb.builder.AbstractBuilderTest;
-import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ApplyToElementFalseApplyToTypeTrue;
-import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ApplyToElementTrueApplyToTypeFalse;
-import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ApplyToElementFalseApplyToTypeFalse;
+import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameFalseComponentContentFalseGroup;
+import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameFalseComponentContentTrue;
+import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameFalseComponentContentTrueGroup;
+import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameTrueComponentContentFalse;
+import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameFalseComponentContentFalse;
+import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameTrueComponentContentFalseGroup;
+import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameTrueComponentContentTrueGroup;
 import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.MissingPrefixMappingException;
 import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.MissingPrefixMappingGoesTarget;
-import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ApplyToElementTrueApplyToTypeTrue;
+import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameTrueComponentContentTrue;
+import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.RootWithGroupWithJBossXmlNsPrefixProperty;
 import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
 import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding;
 import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
@@ -95,7 +100,7 @@
 
    public void testApplyToElementTrueApplyToTypeTrue()
    {
-      SchemaBinding schema = JBossXBBuilder.build(ApplyToElementTrueApplyToTypeTrue.class, true);
+      SchemaBinding schema = JBossXBBuilder.build(ComponentQNameTrueComponentContentTrue.class, true);
       assertNotNull(schema);
       Iterator<ElementBinding> elements = schema.getElements();
       assertTrue(elements.hasNext());
@@ -124,7 +129,7 @@
 
    public void testApplyToElementTrueApplyToTypeFalse()
    {
-      SchemaBinding schema = JBossXBBuilder.build(ApplyToElementTrueApplyToTypeFalse.class, true);
+      SchemaBinding schema = JBossXBBuilder.build(ComponentQNameTrueComponentContentFalse.class, true);
       assertNotNull(schema);
       Iterator<ElementBinding> elements = schema.getElements();
       assertTrue(elements.hasNext());
@@ -159,7 +164,7 @@
 
    public void testApplyToElementFalseApplyToTypeFalse()
    {
-      SchemaBinding schema = JBossXBBuilder.build(ApplyToElementFalseApplyToTypeFalse.class, true);
+      SchemaBinding schema = JBossXBBuilder.build(ComponentQNameFalseComponentContentFalse.class, true);
       assertNotNull(schema);
       Iterator<ElementBinding> elements = schema.getElements();
       assertTrue(elements.hasNext());
@@ -194,7 +199,7 @@
 
    public void testApplyToElementFalseApplyToTypeTrue()
    {
-      SchemaBinding schema = JBossXBBuilder.build(ApplyToElementFalseApplyToTypeTrue.class, true);
+      SchemaBinding schema = JBossXBBuilder.build(ComponentQNameFalseComponentContentTrue.class, true);
       assertNotNull(schema);
       Iterator<ElementBinding> elements = schema.getElements();
       assertTrue(elements.hasNext());
@@ -226,4 +231,150 @@
       e = (ElementBinding) particle.getTerm();
       assertEquals(new QName("ns.root", "root-name"), e.getQName());
    }
+   
+   public void testApplyToElementTrueApplyToTypeTrueGroup() throws Exception
+   {
+      SchemaBinding schema = JBossXBBuilder.build(ComponentQNameTrueComponentContentTrueGroup.class, true);
+      
+      ElementBinding e = schema.getElement(new QName("ns", "root"));
+      assertNotNull(e);
+      ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm();
+      Collection<ParticleBinding> particles = group.getParticles();
+      assertEquals(2, particles.size());
+      Iterator<ParticleBinding> iterator = particles.iterator();
+      
+      group = (ModelGroupBinding) iterator.next().getTerm();
+      assertEquals(new QName("anotherNs", "group"), group.getQName());
+      particles = group.getParticles();
+      assertEquals(2, particles.size());
+      Iterator<ParticleBinding> groupIterator = particles.iterator();
+      e = (ElementBinding) groupIterator.next().getTerm();
+      assertEquals(new QName("anotherNs", "count"), e.getQName());
+      e = (ElementBinding) groupIterator.next().getTerm();
+      assertEquals(new QName("anotherNs", "text"), e.getQName());
+      
+      e = (ElementBinding) iterator.next().getTerm();
+      assertEquals(new QName("ns", "id"), e.getQName());
+   }
+
+   public void testApplyToElementFalseApplyToTypeTrueGroup() throws Exception
+   {
+      SchemaBinding schema = JBossXBBuilder.build(ComponentQNameFalseComponentContentTrueGroup.class, true);
+      
+      ElementBinding e = schema.getElement(new QName("ns", "root"));
+      assertNotNull(e);
+      ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm();
+      Collection<ParticleBinding> particles = group.getParticles();
+      assertEquals(2, particles.size());
+      Iterator<ParticleBinding> iterator = particles.iterator();
+      
+      group = (ModelGroupBinding) iterator.next().getTerm();
+      assertEquals(new QName("ns", "group"), group.getQName());
+      particles = group.getParticles();
+      assertEquals(2, particles.size());
+      Iterator<ParticleBinding> groupIterator = particles.iterator();
+      e = (ElementBinding) groupIterator.next().getTerm();
+      assertEquals(new QName("anotherNs", "count"), e.getQName());
+      e = (ElementBinding) groupIterator.next().getTerm();
+      assertEquals(new QName("anotherNs", "text"), e.getQName());
+      
+      e = (ElementBinding) iterator.next().getTerm();
+      assertEquals(new QName("ns", "id"), e.getQName());
+   }
+
+   public void testApplyToElementTrueApplyToTypeFalseGroup() throws Exception
+   {
+      SchemaBinding schema = JBossXBBuilder.build(ComponentQNameTrueComponentContentFalseGroup.class, true);
+      
+      ElementBinding e = schema.getElement(new QName("ns", "root"));
+      assertNotNull(e);
+      ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm();
+      Collection<ParticleBinding> particles = group.getParticles();
+      assertEquals(2, particles.size());
+      Iterator<ParticleBinding> iterator = particles.iterator();
+      
+      group = (ModelGroupBinding) iterator.next().getTerm();
+      assertEquals(new QName("anotherNs", "group"), group.getQName());
+      particles = group.getParticles();
+      assertEquals(2, particles.size());
+      Iterator<ParticleBinding> groupIterator = particles.iterator();
+      e = (ElementBinding) groupIterator.next().getTerm();
+      assertEquals(new QName("ns", "count"), e.getQName());
+      e = (ElementBinding) groupIterator.next().getTerm();
+      assertEquals(new QName("ns", "text"), e.getQName());
+      
+      e = (ElementBinding) iterator.next().getTerm();
+      assertEquals(new QName("ns", "id"), e.getQName());
+   }
+
+   public void testApplyToElementFalseApplyToTypeFalseGroup() throws Exception
+   {
+      SchemaBinding schema = JBossXBBuilder.build(ComponentQNameFalseComponentContentFalseGroup.class, true);
+      
+      ElementBinding e = schema.getElement(new QName("ns", "root"));
+      assertNotNull(e);
+      ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm();
+      Collection<ParticleBinding> particles = group.getParticles();
+      assertEquals(2, particles.size());
+      Iterator<ParticleBinding> iterator = particles.iterator();
+      
+      group = (ModelGroupBinding) iterator.next().getTerm();
+      assertEquals(new QName("ns", "group"), group.getQName());
+      particles = group.getParticles();
+      assertEquals(2, particles.size());
+      Iterator<ParticleBinding> groupIterator = particles.iterator();
+      e = (ElementBinding) groupIterator.next().getTerm();
+      assertEquals(new QName("ns", "count"), e.getQName());
+      e = (ElementBinding) groupIterator.next().getTerm();
+      assertEquals(new QName("ns", "text"), e.getQName());
+      
+      e = (ElementBinding) iterator.next().getTerm();
+      assertEquals(new QName("ns", "id"), e.getQName());
+   }
+   
+   public void testGroupWithJBossXmlNsProperty() throws Exception
+   {
+      SchemaBinding schema = JBossXBBuilder.build(RootWithGroupWithJBossXmlNsPrefixProperty.class, true);
+      
+      ElementBinding e = schema.getElement(new QName("ns", "root"));
+      ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm();
+      Collection<ParticleBinding> particles = group.getParticles();
+      assertEquals(1, particles.size());
+      group = (ModelGroupBinding) particles.iterator().next().getTerm();
+      particles = group.getParticles();
+      assertEquals(4, particles.size());
+      Iterator<ParticleBinding> iterator = particles.iterator();
+      
+      e = (ElementBinding) iterator.next().getTerm();
+      assertEquals(new QName("childNs", "group-true-content-false"), e.getQName());
+      group = (ModelGroupBinding) e.getType().getParticle().getTerm();
+      particles = group.getParticles();
+      assertEquals(1, particles.size());
+      e = (ElementBinding) particles.iterator().next().getTerm();
+      assertEquals(new QName("ns", "name"), e.getQName());
+      
+      e = (ElementBinding) iterator.next().getTerm();
+      assertEquals(new QName("ns", "group-false-content-false"), e.getQName());
+      group = (ModelGroupBinding) e.getType().getParticle().getTerm();
+      particles = group.getParticles();
+      assertEquals(1, particles.size());
+      e = (ElementBinding) particles.iterator().next().getTerm();
+      assertEquals(new QName("ns", "name"), e.getQName());
+      
+      e = (ElementBinding) iterator.next().getTerm();
+      assertEquals(new QName("childNs", "group-true-content-true"), e.getQName());
+      group = (ModelGroupBinding) e.getType().getParticle().getTerm();
+      particles = group.getParticles();
+      assertEquals(1, particles.size());
+      e = (ElementBinding) particles.iterator().next().getTerm();
+      assertEquals(new QName("childNs", "name"), e.getQName());
+
+      e = (ElementBinding) iterator.next().getTerm();
+      assertEquals(new QName("ns", "group-false-content-true"), e.getQName());
+      group = (ModelGroupBinding) e.getType().getParticle().getTerm();
+      particles = group.getParticles();
+      assertEquals(1, particles.size());
+      e = (ElementBinding) particles.iterator().next().getTerm();
+      assertEquals(new QName("childNs", "name"), e.getQName());
+   }
 }




More information about the jboss-svn-commits mailing list