Package javax.xml.bind.annotation

Examples of javax.xml.bind.annotation.XmlAttribute.required()


                XmlElement element = field.getAnnotation(XmlElement.class);
                if (element != null && element.required()) {
                  return true;
                }
                XmlAttribute attribute = field.getAnnotation(XmlAttribute.class);
                if (attribute != null && attribute.required()) {
                  return true;
                }
              }
            }
          }
View Full Code Here


               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)
View Full Code Here

        assertTrue(xmlType.factoryClass() == TestBean1.class);

        XmlAttribute xmlAttribute = reader.getMethodAnnotation(XmlAttribute.class, testBean1Method, null);
        assertEquals("##default", xmlAttribute.name());
        assertEquals("http://jbossesb.z.jboss.org", xmlAttribute.namespace());
        assertFalse(xmlAttribute.required());

        XmlElement xmlElement = reader.getFieldAnnotation(XmlElement.class, testBean2Field, null);
        assertEquals("OrderNum", xmlElement.name());
        assertTrue(xmlElement.nillable());
        assertTrue(xmlElement.type() == TestBean2.class);
View Full Code Here

               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);
               if (trace)
                  log.trace("Bound attribute " + qName + " type=" + beanInfo.getName() + " property=" + property.getName() + " propertyType=" + attributeTypeInfo);
            }
View Full Code Here

/*  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

/*     */   {
/*  59 */     super(parent, seed);
/*  60 */     XmlAttribute att = (XmlAttribute)seed.readAnnotation(XmlAttribute.class);
/*  61 */     assert (att != null);
/*     */
/*  63 */     if (att.required())
/*  64 */       this.isRequired = true;
/*  65 */     else this.isRequired = nav().isPrimitive(getIndividualType());
/*     */
/*  67 */     this.xmlName = calcXmlName(att);
/*     */   }
View Full Code Here

               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)
View Full Code Here

    AttributePropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent, PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> seed ) {
        super(parent,seed);
        XmlAttribute att = seed.readAnnotation(XmlAttribute.class);
        assert att!=null;

        if(att.required())
            isRequired = true;
        else isRequired = nav().isPrimitive(getIndividualType());

        this.xmlName = calcXmlName(att);
    }
View Full Code Here

    // See http://forums.java.net/jive/thread.jspa?messageID=167171
    // Primitives are always required

    XmlAttribute attribute = _accessor.getAnnotation(XmlAttribute.class);

    if (attribute.required() ||
        (_generateRICompatibleSchema && _accessor.getType().isPrimitive()))
      out.writeAttribute("use", "required");

    XmlID xmlID = _accessor.getAnnotation(XmlID.class);
View Full Code Here

    AttributePropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent, PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> seed ) {
        super(parent,seed);
        XmlAttribute att = seed.readAnnotation(XmlAttribute.class);
        assert att!=null;

        if(att.required())
            isRequired = true;
        else isRequired = nav().isPrimitive(getIndividualType());

        this.xmlName = calcXmlName(att);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.