Java Code Examples for com.sun.tools.internal.xjc.model.CAttributePropertyInfo#isRequired()

The following examples show how to use com.sun.tools.internal.xjc.model.CAttributePropertyInfo#isRequired() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractField.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();

    // Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
    // 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);
    }
}
 
Example 2
Source File: AbstractField.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();

    // Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
    // 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);
    }
}
 
Example 3
Source File: AbstractField.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();

    // Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
    // 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);
    }
}
 
Example 4
Source File: AbstractField.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();

    // Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
    // 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);
    }
}
 
Example 5
Source File: AbstractField.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();

    // Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
    // 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);
    }
}
 
Example 6
Source File: AbstractField.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();

    // Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
    // 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);
    }
}
 
Example 7
Source File: AbstractField.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();

    // Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
    // 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);
    }
}
 
Example 8
Source File: AbstractField.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();

    // Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
    // 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);
    }
}