use of com.sun.tools.xjc.generator.annotation.spec.XmlAttributeWriter in project jaxb-ri by eclipse-ee4j.
the class AbstractField method annotateAttribute.
/**
* Annotate the attribute property 'field'
*/
private void annotateAttribute(JAnnotatable field) {
CAttributePropertyInfo ap = (CAttributePropertyInfo) prop;
QName attName = ap.getXmlName();
// [RESULT]
// @XmlAttribute(name="foo", required=true, namespace="bar://baz")
XmlAttributeWriter xaw = field.annotate2(XmlAttributeWriter.class);
final String generatedName = attName.getLocalPart();
final String generatedNS = attName.getNamespaceURI();
// generate name property?
if (!generatedName.equals(ap.getName(false)) || !generatedName.equals(ap.getName(true)) || (outline.parent().getModel().getNameConverter() != NameConverter.standard)) {
xaw.name(generatedName);
}
// generate namespace property?
if (!generatedNS.equals("")) {
// assume attributeFormDefault == unqualified
xaw.namespace(generatedNS);
}
// generate required property?
if (ap.isRequired()) {
xaw.required(true);
}
}
Aggregations