Package javax.xml.bind.annotation

Examples of javax.xml.bind.annotation.XmlElement.nillable()


                           Field declaredField = getDeclaredField(clazz,name);
                           XmlElement   xmlElm   =  declaredField.getAnnotation(XmlElement.class);
                             if(xmlElm != null){
                               if(!xmlElm.defaultValue().equals(NULL) && isJSONPrimitive(propertyType)){
                                 value = xmlElm.defaultValue();
                               } else if(!xmlElm.nillable() && createDefaultOnNonNullable){
                                 if(!isJSONPrimitive(propertyType)){
                                   if(!stackNillableInstances.contains(propertyType)){
                                     stackNillableInstances.push(propertyType);
                                     value = getNewInstance(propertyType);
                                     hasData = this.add(name, value, null, hasData, property) || hasData;
View Full Code Here


                traceLog.info(String.format("Input do not have %s. Populating default value: %s. flag to populate: %b",
                    expectedJSONPropName, element.defaultValue(), createDefaultOnNonNullable));
              writeMethod.invoke(object,
                  convert(propertyType, f.getType(), element.defaultValue(),
                      writeMethodConfig, writeMethod));
            } else if (!element.nillable() && createDefaultOnNonNullable) {
              // there is no default value and non nullable.
              if(!isJSONPrimitive(propertyType)){
                if(traceEnabled)
                  traceLog.warn("Non nillable object(\""+expectedJSONPropName +
                    "\") with nill value, populating default.");
View Full Code Here

                    assert el != null;
                }
            }
           
            if (part == null) {
                if (!el.nillable()) {
                    throw new IllegalArgumentException("null value for field not permitted.");
                }
                return;
            }
View Full Code Here

    _property = _context.createProperty(accessor.getGenericType(), false,
                                        mimeType, xmlList);

    if (element != null) {
      _qname = qnameFromXmlElement(element);
      _nillable = element.nillable();
    }
    else {
      XmlSchema xmlSchema = accessor.getPackageAnnotation(XmlSchema.class);

      if (xmlSchema != null &&
View Full Code Here

          if (element.required())
            out.writeAttribute("minOccurs", "1");
          else
            out.writeAttribute("minOccurs", "0");

          if (element.nillable())
            out.writeAttribute("nillable", "true");
        }
        else
          out.writeAttribute("minOccurs", "0");
      }
View Full Code Here

      }

      if (_property.getMaxOccurs() != null)
        out.writeAttribute("maxOccurs", _property.getMaxOccurs());

      if ((element != null && element.nillable()) ||
          Collection.class.isAssignableFrom(_accessor.getType()) ||
          (_accessor.getType().isArray() &&
           ! byte.class.equals(_accessor.getType().getComponentType())))
        out.writeAttribute("nillable", "true");
View Full Code Here

            } else if (ann instanceof XmlElement) {
                addedEl = true;  
                XmlElement el = (XmlElement)ann;
                av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlElement;", true);
                av0.visit("name", el.name());
                av0.visit("nillable", el.nillable());
                av0.visit("requried", el.required());
                av0.visit("namespace", el.namespace());
                av0.visit("defaultValue", el.defaultValue());
                av0.visit("type", el.type());
                av0.visitEnd();
View Full Code Here

     */
    private void processXmlElement(Property property, TypeInfo info) {
        if (helper.isAnnotationPresent(property.getElement(), XmlElement.class)) {
            XmlElement element = (XmlElement) helper.getAnnotation(property.getElement(), XmlElement.class);
            property.setIsRequired(element.required());
            property.setNillable(element.nillable());
            if (element.type() != XmlElement.DEFAULT.class && !(property.isSwaAttachmentRef())) {
                property.setOriginalType(property.getType());
                if (isCollectionType(property.getType())) {
                    property.setGenericType(helper.getJavaClass(element.type()));
                } else {
View Full Code Here

            XmlElement next = elements[i];
            org.eclipse.persistence.jaxb.xmlmodel.XmlElement xmlElement = new org.eclipse.persistence.jaxb.xmlmodel.XmlElement();
            xmlElement.setDefaultValue(next.defaultValue());
            xmlElement.setName(next.name());
            xmlElement.setNamespace(next.namespace());
            xmlElement.setNillable(next.nillable());
            xmlElement.setRequired(next.required());
            xmlElement.setType(next.type().getName());
            xmlElements.getXmlElement().add(xmlElement);
        }
        choiceProperty.setXmlElements(xmlElements);
View Full Code Here

     */
    private void processXmlElement(Property property, TypeInfo info) {
        if (helper.isAnnotationPresent(property.getElement(), XmlElement.class)) {
            XmlElement element = (XmlElement) helper.getAnnotation(property.getElement(), XmlElement.class);
            property.setIsRequired(element.required());
            property.setNillable(element.nillable());
            if (element.type() != XmlElement.DEFAULT.class && !(property.isSwaAttachmentRef())) {
                property.setOriginalType(property.getType());
                if (helper.isCollectionType(property.getType()) || property.getType().isArray()) {
                    property.setGenericType(helper.getJavaClass(element.type()));
                } else {
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.