Package org.jboss.xb.binding.sunday.unmarshalling

Examples of org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding


/*  844 */             attributeTypeInfo = attributeTypeInfo.getTypeInfoFactory().getTypeInfo(jbossXmlAttribute.type());
/*  845 */           TypeBinding attributeType = resolveTypeBinding(attributeTypeInfo);
/*      */
/*  847 */           AttributeHandler attributeHandler = new PropertyHandler(property, attributeTypeInfo);
/*      */
/*  849 */           AttributeBinding attribute = new AttributeBinding(this.schemaBinding, qName, attributeType, attributeHandler);
/*  850 */           attribute.setRequired(xmlAttribute.required());
/*  851 */           typeBinding.addAttribute(attribute);
/*  852 */           if (this.trace) {
/*  853 */             log.trace("Bound attribute " + qName + " type=" + beanInfo.getName() + " property=" + property.getName() + " propertyType=" + attributeTypeInfo);
/*      */           }
/*      */         }
View Full Code Here


/*     */                 }
/*     */               }
/*     */             }
/* 436 */             else if ((binding instanceof AttributeBinding))
/*     */             {
/* 438 */               AttributeBinding attr = (AttributeBinding)binding;
/* 439 */               AttributeHandler handler = attr.getHandler();
/* 440 */               if (handler != null)
/*     */               {
/* 442 */                 if (this.parentValueList != null)
/*     */                 {
/* 444 */                   this.parentValueList.setAttributeValue(attr.getQName(), attr, valueEntry.value);
/*     */                 }
/*     */                 else
/*     */                 {
/* 448 */                   handler.attribute(valueEntry.qName, attr.getQName(), attr, this.val$parent, valueEntry.value);
/*     */                 }
/*     */               }
/*     */               else
/*     */               {
/* 453 */                 throw new JBossXBRuntimeException("Attribute binding present but has no handler: element=" + valueEntry.qName + ", attrinute=" + attr.getQName());
/*     */               }
/*     */
/*     */             }
/*     */             else
/*     */             {
View Full Code Here

/*      */   {
/*  741 */     TypeBinding type = element.getType();
/*  742 */     for (int i = 0; i < attrs.getLength(); i++)
/*      */     {
/*  744 */       QName attrName = new QName(attrs.getURI(i), attrs.getLocalName(i));
/*  745 */       AttributeBinding binding = type.getAttribute(attrName);
/*  746 */       if (binding != null)
/*      */       {
/*  748 */         AttributeHandler handler = binding.getHandler();
/*  749 */         if (handler != null)
/*      */         {
/*  751 */           Object value = handler.unmarshal(elementName, attrName, binding, nsCtx, attrs.getValue(i));
/*  752 */           handler.attribute(elementName, attrName, binding, o, value);
/*      */         }
View Full Code Here

                  attributeTypeInfo = attributeTypeInfo.getTypeInfoFactory().getTypeInfo(jbossXmlAttribute.type());
               TypeBinding attributeType = resolveTypeBinding(attributeTypeInfo);
               // Create the attribute handler
               AttributeHandler attributeHandler = new PropertyHandler(property, attributeTypeInfo);
               // Create the attributre and bind it to the type
               AttributeBinding attribute = new AttributeBinding(schemaBinding, qName, attributeType, attributeHandler);
               attribute.setRequired(xmlAttribute.required());
               typeBinding.addAttribute(attribute);
               JBossXmlPreserveWhitespace preserveSpace = property.getUnderlyingAnnotation(JBossXmlPreserveWhitespace.class);
               if(preserveSpace != null)
                  attribute.setNormalizeSpace(preserveSpace.preserve() ? false : true);
               if (trace)
                  log.trace("Bound attribute " + qName + " type=" + beanInfo.getName() + " property=" + property.getName() + " propertyType=" + attributeTypeInfo + ", normalizeSpace=" + attribute.isNormalizeSpace());
            }

            // Is this any attribute
            XmlAnyAttribute xmlAnyAttribute = property.getUnderlyingAnnotation(XmlAnyAttribute.class);
            if (xmlAnyAttribute != null)
View Full Code Here

            if(keyAttribute != null)
            {
               TypeBinding attributeType = resolveTypeBinding(keyType);
               AttributeHandler attributeHandler = new PropertyHandler(entryInfo.getProperty("key"), keyType);
               QName attrQName = generateXmlName(keyType, attributeForm, keyAttribute.namespace(), keyAttribute.name());
               AttributeBinding keyBinding = new AttributeBinding(schemaBinding, attrQName, attributeType, attributeHandler);
               keyBinding.setRequired(true);
               entryType.addAttribute(keyBinding);
            }

            if(valueAttribute != null)
            {
               TypeBinding attributeType = resolveTypeBinding(valueType);
               AttributeHandler attributeHandler = new PropertyHandler(entryInfo.getProperty("value"), valueType);
               QName attrQName = generateXmlName(valueType, attributeForm, valueAttribute.namespace(), valueAttribute.name());
               AttributeBinding valueBinding = new AttributeBinding(schemaBinding, attrQName, attributeType, attributeHandler);
               valueBinding.setRequired(true);
               entryType.addAttribute(valueBinding);
            }
            else if(valueElement == null)
            {
               CharactersHandler charactersHandler = new ValueHandler(entryInfo.getProperty("value"), valueType);
View Full Code Here

   public void testBinding() throws Exception
   {
      assertNotNull(SCHEMA);
      ElementBinding element = SCHEMA.getElement(new QName("root"));
      assertNotNull(element);
      AttributeBinding attribute = element.getType().getAttribute(new QName("unqualified"));
      assertNotNull(attribute);
      assertTrue(attribute.getRequired());
   }
View Full Code Here

   {
      TypeBinding type = element.getType();
      for(int i = 0; i < attrs.getLength(); ++i)
      {
         QName attrName = new QName(attrs.getURI(i), attrs.getLocalName(i));
         AttributeBinding binding = type.getAttribute(attrName);
         if(binding != null)
         {
            AttributeHandler handler = binding.getHandler();
            if(handler != null)
            {
               Object value = handler.unmarshal(elementName, attrName, binding, nsCtx, attrs.getValue(i));
               handler.attribute(elementName, attrName, binding, o, value);
            }
View Full Code Here

                        }
                     }
                  }
                  else if(binding instanceof AttributeBinding)
                  {
                     AttributeBinding attr = (AttributeBinding)binding;
                     AttributeHandler handler = attr.getHandler();
                     if(handler != null)
                     {
                        if(parentValueList != null)
                        {
                           parentValueList.setAttributeValue(attr.getQName(), attr, valueEntry.value);
                        }
                        else
                        {
                           handler.attribute(valueEntry.qName, attr.getQName(), attr, parent, valueEntry.value);
                        }
                     }
                     else
                     {
                        throw new JBossXBRuntimeException("Attribute binding present but has no handler: element=" +
                           valueEntry.qName +
                           ", attrinute=" +
                           attr.getQName()
                        );
                     }
                  }
                  else
                  {
View Full Code Here

   {
      TypeBinding type = element.getType();
      for(int i = 0; i < attrs.getLength(); ++i)
      {
         QName attrName = new QName(attrs.getURI(i), attrs.getLocalName(i));
         AttributeBinding binding = type.getAttribute(attrName);
         if(binding != null)
         {
            AttributeHandler handler = binding.getHandler();
            if(handler != null)
            {
               Object value = handler.unmarshal(elementName, attrName, binding, nsCtx, attrs.getValue(i));
               handler.attribute(elementName, attrName, binding, o, value);
            }
View Full Code Here

TOP

Related Classes of org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.