public boolean nillable() { return core.nillable(); }
/** * Adds a new element to the list of elements to be written. */ public void add( ElementInfo<T,C> elem ) { assert elem!=null; @SuppressWarnings("UnusedAssignment") boolean nillable = false; // default value QName name = elem.getElementName(); Namespace n = getNamespace(name.getNamespaceURI()); ElementInfo ei; if (elem.getScope() != null) { // (probably) never happens ei = this.types.getElementInfo(elem.getScope().getClazz(), name); } else { ei = this.types.getElementInfo(null, name); } XmlElement xmlElem = ei.getProperty().readAnnotation(XmlElement.class); if (xmlElem == null) { nillable = false; } else { nillable = xmlElem.nillable(); } n.elementDecls.put(name.getLocalPart(),n.new ElementWithType(nillable, elem.getContentType())); // search for foreign namespace references n.processForeignNamespaces(elem.getProperty(), 1); }
public boolean nillable() { return core.nillable(); }
if((!nav().isPrimitive(type) || isCollection()) && !item.required()) isRequired = false; types.add(createTypeRef(name, type, item.nillable(), getDefaultValue(item.defaultValue()) ));
JsonInclude.Include _serializationInclusion(Annotated a, JsonInclude.Include defValue) { XmlElementWrapper w = a.getAnnotation(XmlElementWrapper.class); if (w != null) { if (w.nillable()) { return JsonInclude.Include.ALWAYS; } // [jaxb-annotations#52]: Allow specifying inclusion for `nillable=false` too if (_nonNillableInclusion != null) { return _nonNillableInclusion; } } XmlElement e = a.getAnnotation(XmlElement.class); if (e != null) { if (e.nillable()) { return JsonInclude.Include.ALWAYS; } // [jaxb-annotations#52]: Allow specifying inclusion for `nillable=false` too if (_nonNillableInclusion != null) { return _nonNillableInclusion; } } //better pass default value through, if no explicit direction indicating otherwise return defValue; }
/** * Whether this element is nillable. * * @return Whether this element is nillable. */ public boolean isNillable() { boolean nillable = false; if (xmlElement != null) { nillable = xmlElement.nillable(); } return nillable; }
/** * Whether this element is nillable. * * @return Whether this element is nillable. */ public boolean isNillable() { boolean nillable = false; if (xmlElement != null) { nillable = xmlElement.nillable(); } return nillable; }
/** * Whether this element is nillable. * * @return Whether this element is nillable. */ public boolean isNillable() { boolean nillable = false; if (xmlElement != null) { nillable = xmlElement.nillable(); } return nillable; }
/** * Whether this element is nillable. * * @return Whether this element is nillable. */ public boolean isNillable() { boolean nillable = false; if (xmlElement != null) { nillable = xmlElement.nillable(); } return nillable; }
/** * Adds a new element to the list of elements to be written. */ public void add( ElementInfo<T,C> elem ) { assert elem!=null; @SuppressWarnings("UnusedAssignment") boolean nillable = false; // default value QName name = elem.getElementName(); Namespace n = getNamespace(name.getNamespaceURI()); ElementInfo ei; if (elem.getScope() != null) { // (probably) never happens ei = this.types.getElementInfo(elem.getScope().getClazz(), name); } else { ei = this.types.getElementInfo(null, name); } XmlElement xmlElem = ei.getProperty().readAnnotation(XmlElement.class); if (xmlElem == null) { nillable = false; } else { nillable = xmlElem.nillable(); } n.elementDecls.put(name.getLocalPart(),n.new ElementWithType(nillable, elem.getContentType())); // search for foreign namespace references n.processForeignNamespaces(elem.getProperty(), 1); }
public boolean nillable() { return core.nillable(); }
public boolean nillable() { return core.nillable(); }
if((!nav().isPrimitive(type) || isCollection()) && !item.required()) isRequired = false; types.add(createTypeRef(name, type, item.nillable(), getDefaultValue(item.defaultValue()) ));
static boolean isVariableRequired(XmlElement annotation) { return !annotation.nillable() && annotation.required(); }
private void processXmlElement(List<Annotation> jaxb, String elemName, String elemNS, T type) { XmlElement elemAnn = null; for (Annotation a : jaxb) { if (a.annotationType() == XmlElement.class) { elemAnn = (XmlElement) a; jaxb.remove(a); break; } } String name = (elemAnn != null && !elemAnn.name().equals("##default")) ? elemAnn.name() : elemName; String ns = (elemAnn != null && !elemAnn.namespace().equals("##default")) ? elemAnn.namespace() : elemNS; boolean nillable = nav.isArray(type) || (elemAnn != null && elemAnn.nillable()); boolean required = elemAnn != null && elemAnn.required(); XmlElementHandler handler = new XmlElementHandler(name, ns, nillable, required); XmlElement elem = (XmlElement) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class<?>[]{XmlElement.class}, handler); jaxb.add(elem); }
private void processXmlElement(List<Annotation> jaxb, String elemName, String elemNS, T type) { XmlElement elemAnn = null; for (Annotation a : jaxb) { if (a.annotationType() == XmlElement.class) { elemAnn = (XmlElement) a; jaxb.remove(a); break; } } String name = (elemAnn != null && !elemAnn.name().equals("##default")) ? elemAnn.name() : elemName; String ns = (elemAnn != null && !elemAnn.namespace().equals("##default")) ? elemAnn.namespace() : elemNS; boolean nillable = nav.isArray(type) || (elemAnn != null && elemAnn.nillable()); boolean required = elemAnn != null && elemAnn.required(); XmlElementHandler handler = new XmlElementHandler(name, ns, nillable, required); XmlElement elem = (XmlElement) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class<?>[]{XmlElement.class}, handler); jaxb.add(elem); }
av0.visit("name", el.name()); av0.visit("nillable", el.nillable()); av0.visit("required", el.required()); av0.visit("namespace", el.namespace());
private void processXmlElement(List<Annotation> jaxb, String elemName, String elemNS, T type) { XmlElement elemAnn = null; for (Annotation a : jaxb) { if (a.annotationType() == XmlElement.class) { elemAnn = (XmlElement) a; jaxb.remove(a); break; } } String name = (elemAnn != null && !elemAnn.name().equals("##default")) ? elemAnn.name() : elemName; String ns = (elemAnn != null && !elemAnn.namespace().equals("##default")) ? elemAnn.namespace() : elemNS; boolean nillable = nav.isArray(type) || (elemAnn != null && elemAnn.nillable()); boolean required = elemAnn != null && elemAnn.required(); XmlElementHandler handler = new XmlElementHandler(name, ns, nillable, required); XmlElement elem = (XmlElement) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class<?>[]{XmlElement.class}, handler); jaxb.add(elem); }
/** * Implementation of this method is slightly tricky, given that JAXB defaults differ * from Jackson defaults. As of version 1.5 and above, this is resolved by honoring * Jackson defaults (which are configurable), and only using JAXB explicit annotations. */ @Override public JsonInclude.Include findSerializationInclusion(Annotated a, JsonInclude.Include defValue) { XmlElementWrapper w = a.getAnnotation(XmlElementWrapper.class); if (w != null) { if (w.nillable()) { return JsonInclude.Include.ALWAYS; } } XmlElement e = a.getAnnotation(XmlElement.class); if (e != null) { if (e.nillable()) { return JsonInclude.Include.ALWAYS; } } /* [JACKSON-256]: better pass default value through, if no explicit direction indicating * otherwise */ return defValue; }
/** * Adds a new element to the list of elements to be written. */ public void add( ElementInfo<T,C> elem ) { assert elem!=null; @SuppressWarnings("UnusedAssignment") boolean nillable = false; // default value QName name = elem.getElementName(); Namespace n = getNamespace(name.getNamespaceURI()); ElementInfo ei; if (elem.getScope() != null) { // (probably) never happens ei = this.types.getElementInfo(elem.getScope().getClazz(), name); } else { ei = this.types.getElementInfo(null, name); } XmlElement xmlElem = ei.getProperty().readAnnotation(XmlElement.class); if (xmlElem == null) { nillable = false; } else { nillable = xmlElem.nillable(); } n.elementDecls.put(name.getLocalPart(),n.new ElementWithType(nillable, elem.getContentType())); // search for foreign namespace references n.processForeignNamespaces(elem.getProperty(), 1); }