Search in sources :

Example 1 with BIElement

use of com.sun.tools.xjc.reader.dtd.bindinfo.BIElement in project jaxb-ri by eclipse-ee4j.

the class TDTDReader method processConstructorDeclarations.

/**
 * Creates constructor declarations as specified in the
 * binding information.
 *
 * <p>
 * Also checks that the binding file does not contain
 * declarations for non-existent elements.
 */
private void processConstructorDeclarations() {
    for (BIElement decl : bindInfo.elements()) {
        Element e = elements.get(decl.name());
        if (e == null) {
            error(decl.getSourceLocation(), Messages.ERR_BINDINFO_NON_EXISTENT_ELEMENT_DECLARATION, decl.name());
            // continue to process next declaration
            continue;
        }
        if (!decl.isClass())
            // only element-class declaration has constructor definitions
            continue;
        decl.declareConstructors(e.getClassInfo());
    }
}
Also used : BIElement(com.sun.tools.xjc.reader.dtd.bindinfo.BIElement) BIElement(com.sun.tools.xjc.reader.dtd.bindinfo.BIElement)

Example 2 with BIElement

use of com.sun.tools.xjc.reader.dtd.bindinfo.BIElement in project jaxb-ri by eclipse-ee4j.

the class TDTDReader method createAttribute.

protected CPropertyInfo createAttribute(String elementName, String attributeName, String attributeType, String[] enums, short attributeUse, String defaultValue) throws SAXException {
    boolean required = attributeUse == USE_REQUIRED;
    // get the attribute-property declaration
    BIElement edecl = bindInfo.element(elementName);
    BIAttribute decl = null;
    if (edecl != null)
        decl = edecl.attribute(attributeName);
    String propName;
    if (decl == null)
        propName = model.getNameConverter().toPropertyName(attributeName);
    else
        propName = decl.getPropertyName();
    QName qname = new QName("", attributeName);
    // if no declaration is specified, just wrap it by
    // a FieldItem and let the normalizer handle its content.
    TypeUse use;
    if (decl != null && decl.getConversion() != null)
        use = decl.getConversion().getTransducer();
    else
        use = builtinConversions.get(attributeType);
    CPropertyInfo r = new CAttributePropertyInfo(propName, null, null, /*TODO*/
    copyLocator(), qname, use, null, required);
    if (defaultValue != null)
        r.defaultValue = CDefaultValue.create(use, new XmlString(defaultValue));
    return r;
}
Also used : TypeUse(com.sun.tools.xjc.model.TypeUse) BIElement(com.sun.tools.xjc.reader.dtd.bindinfo.BIElement) BIAttribute(com.sun.tools.xjc.reader.dtd.bindinfo.BIAttribute) QName(javax.xml.namespace.QName) XmlString(com.sun.xml.xsom.XmlString) XmlString(com.sun.xml.xsom.XmlString) CAttributePropertyInfo(com.sun.tools.xjc.model.CAttributePropertyInfo) CPropertyInfo(com.sun.tools.xjc.model.CPropertyInfo)

Aggregations

BIElement (com.sun.tools.xjc.reader.dtd.bindinfo.BIElement)2 CAttributePropertyInfo (com.sun.tools.xjc.model.CAttributePropertyInfo)1 CPropertyInfo (com.sun.tools.xjc.model.CPropertyInfo)1 TypeUse (com.sun.tools.xjc.model.TypeUse)1 BIAttribute (com.sun.tools.xjc.reader.dtd.bindinfo.BIAttribute)1 XmlString (com.sun.xml.xsom.XmlString)1 QName (javax.xml.namespace.QName)1