Search in sources :

Example 6 with CCustomizations

use of com.sun.tools.xjc.model.CCustomizations in project jaxb-ri by eclipse-ee4j.

the class DefaultClassBinder method elementDecl.

@Override
public CElement elementDecl(XSElementDecl decl) {
    CElement r = allow(decl, decl.getName());
    if (r == null) {
        QName tagName = getName(decl);
        CCustomizations custs = builder.getBindInfo(decl).toCustomizationList();
        if (decl.isGlobal()) {
            if (isCollapsable(decl)) {
                // so the binding cannot be delayed.
                return selector.bindToType(decl.getType().asComplexType(), decl, true);
            } else {
                String className = null;
                if (getGlobalBinding().isGenerateElementClass())
                    className = deriveName(decl);
                // otherwise map global elements to JAXBElement
                CElementInfo cei = new CElementInfo(model, tagName, selector.getClassScope(), className, custs, decl.getLocator());
                selector.boundElements.put(decl, cei);
                // referer is element
                stb.refererStack.push(decl);
                cei.initContentType(selector.bindToType(decl.getType(), decl), decl, decl.getDefaultValue());
                stb.refererStack.pop();
                r = cei;
            }
        }
    }
    // have the substitution member derive from the substitution head
    XSElementDecl top = decl.getSubstAffiliation();
    if (top != null) {
        CElement topci = selector.bindToType(top, decl);
        if (r instanceof CClassInfo && topci instanceof CClassInfo)
            ((CClassInfo) r).setBaseClass((CClassInfo) topci);
        if (r instanceof CElementInfo && topci instanceof CElementInfo)
            ((CElementInfo) r).setSubstitutionHead((CElementInfo) topci);
    }
    return r;
}
Also used : CCustomizations(com.sun.tools.xjc.model.CCustomizations) CClassInfo(com.sun.tools.xjc.model.CClassInfo) CElement(com.sun.tools.xjc.model.CElement) QName(javax.xml.namespace.QName) CElementInfo(com.sun.tools.xjc.model.CElementInfo) XSElementDecl(com.sun.xml.xsom.XSElementDecl)

Example 7 with CCustomizations

use of com.sun.tools.xjc.model.CCustomizations in project vcd-api-tools by vmware.

the class RestApiVersionsPlugin method processClassOutline.

/**
 * Annotates {@link ClassOutline}.
 *
 * @param classOutline
 * @param errorHandler
 */
private void processClassOutline(ClassOutline classOutline, ErrorHandler errorHandler) {
    CCustomizations customizations = CustomizationUtils.getCustomizations(classOutline);
    JDefinedClass implClass = classOutline.implClass;
    addSupportedAnnotation(implClass, customizations);
    addContentTypeAnnotation(classOutline, customizations);
    addSourceLocationComment(implClass, classOutline.target.getLocator());
    for (FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
        processFieldOutline(fieldOutline, errorHandler);
    }
}
Also used : CCustomizations(com.sun.tools.xjc.model.CCustomizations) JDefinedClass(com.sun.codemodel.JDefinedClass) FieldOutline(com.sun.tools.xjc.outline.FieldOutline)

Aggregations

CCustomizations (com.sun.tools.xjc.model.CCustomizations)7 JDefinedClass (com.sun.codemodel.JDefinedClass)1 CClassInfo (com.sun.tools.xjc.model.CClassInfo)1 CElement (com.sun.tools.xjc.model.CElement)1 CElementInfo (com.sun.tools.xjc.model.CElementInfo)1 CPluginCustomization (com.sun.tools.xjc.model.CPluginCustomization)1 EnumConstantOutline (com.sun.tools.xjc.outline.EnumConstantOutline)1 FieldOutline (com.sun.tools.xjc.outline.FieldOutline)1 XSElementDecl (com.sun.xml.xsom.XSElementDecl)1 QName (javax.xml.namespace.QName)1