Search in sources :

Example 61 with RuntimeContext

use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.

the class ExcludeList$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final ExcludeList excludeList, RuntimeContext context) throws Exception {
    if (excludeList == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (ExcludeList.class != excludeList.getClass()) {
        context.unexpectedSubclass(writer, excludeList, ExcludeList.class);
        return;
    }
    context.beforeMarshal(excludeList, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = excludeList.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(excludeList, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = excludeList.getDescriptions();
    } catch (final Exception e) {
        context.getterError(excludeList, "descriptions", ExcludeList.class, "getDescriptions", e);
    }
    if (descriptions != null) {
        for (final Text descriptionsItem : descriptions) {
            if (descriptionsItem != null) {
                writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, descriptionsItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(excludeList, "descriptions");
            }
        }
    }
    // ELEMENT: method
    final List<Method> method = excludeList.method;
    if (method != null) {
        for (final Method methodItem : method) {
            if (methodItem != null) {
                writer.writeStartElement(prefix, "method", "http://java.sun.com/xml/ns/javaee");
                writeMethod(writer, methodItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(excludeList, "method");
            }
        }
    }
    context.afterMarshal(excludeList, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) Method$JAXB.readMethod(org.apache.openejb.jee.Method$JAXB.readMethod) Method$JAXB.writeMethod(org.apache.openejb.jee.Method$JAXB.writeMethod) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 62 with RuntimeContext

use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.

the class FacesApplication$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final FacesApplication facesApplication, RuntimeContext context) throws Exception {
    if (facesApplication == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (FacesApplication.class != facesApplication.getClass()) {
        context.unexpectedSubclass(writer, facesApplication, FacesApplication.class);
        return;
    }
    context.beforeMarshal(facesApplication, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = facesApplication.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(facesApplication, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: actionListener
    final List<String> actionListenerRaw = facesApplication.actionListener;
    if (actionListenerRaw != null) {
        for (final String actionListenerItem : actionListenerRaw) {
            String actionListener = null;
            try {
                actionListener = Adapters.collapsedStringAdapterAdapter.marshal(actionListenerItem);
            } catch (final Exception e) {
                context.xmlAdapterError(facesApplication, "actionListener", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (actionListener != null) {
                writer.writeStartElement(prefix, "action-listener", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(actionListener);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: defaultRenderKitId
    final List<String> defaultRenderKitIdRaw = facesApplication.defaultRenderKitId;
    if (defaultRenderKitIdRaw != null) {
        for (final String defaultRenderKitIdItem : defaultRenderKitIdRaw) {
            String defaultRenderKitId = null;
            try {
                defaultRenderKitId = Adapters.collapsedStringAdapterAdapter.marshal(defaultRenderKitIdItem);
            } catch (final Exception e) {
                context.xmlAdapterError(facesApplication, "defaultRenderKitId", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (defaultRenderKitId != null) {
                writer.writeStartElement(prefix, "default-render-kit-id", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(defaultRenderKitId);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: messageBundle
    final List<String> messageBundleRaw = facesApplication.messageBundle;
    if (messageBundleRaw != null) {
        for (final String messageBundleItem : messageBundleRaw) {
            String messageBundle = null;
            try {
                messageBundle = Adapters.collapsedStringAdapterAdapter.marshal(messageBundleItem);
            } catch (final Exception e) {
                context.xmlAdapterError(facesApplication, "messageBundle", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (messageBundle != null) {
                writer.writeStartElement(prefix, "message-bundle", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(messageBundle);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: navigationHandler
    final List<String> navigationHandlerRaw = facesApplication.navigationHandler;
    if (navigationHandlerRaw != null) {
        for (final String navigationHandlerItem : navigationHandlerRaw) {
            String navigationHandler = null;
            try {
                navigationHandler = Adapters.collapsedStringAdapterAdapter.marshal(navigationHandlerItem);
            } catch (final Exception e) {
                context.xmlAdapterError(facesApplication, "navigationHandler", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (navigationHandler != null) {
                writer.writeStartElement(prefix, "navigation-handler", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(navigationHandler);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: viewHandler
    final List<String> viewHandlerRaw = facesApplication.viewHandler;
    if (viewHandlerRaw != null) {
        for (final String viewHandlerItem : viewHandlerRaw) {
            String viewHandler = null;
            try {
                viewHandler = Adapters.collapsedStringAdapterAdapter.marshal(viewHandlerItem);
            } catch (final Exception e) {
                context.xmlAdapterError(facesApplication, "viewHandler", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (viewHandler != null) {
                writer.writeStartElement(prefix, "view-handler", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(viewHandler);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: stateManager
    final List<String> stateManagerRaw = facesApplication.stateManager;
    if (stateManagerRaw != null) {
        for (final String stateManagerItem : stateManagerRaw) {
            String stateManager = null;
            try {
                stateManager = Adapters.collapsedStringAdapterAdapter.marshal(stateManagerItem);
            } catch (final Exception e) {
                context.xmlAdapterError(facesApplication, "stateManager", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (stateManager != null) {
                writer.writeStartElement(prefix, "state-manager", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(stateManager);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: elResolver
    final List<String> elResolverRaw = facesApplication.elResolver;
    if (elResolverRaw != null) {
        for (final String elResolverItem : elResolverRaw) {
            String elResolver = null;
            try {
                elResolver = Adapters.collapsedStringAdapterAdapter.marshal(elResolverItem);
            } catch (final Exception e) {
                context.xmlAdapterError(facesApplication, "elResolver", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (elResolver != null) {
                writer.writeStartElement(prefix, "el-resolver", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(elResolver);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: propertyResolver
    final List<String> propertyResolverRaw = facesApplication.propertyResolver;
    if (propertyResolverRaw != null) {
        for (final String propertyResolverItem : propertyResolverRaw) {
            String propertyResolver = null;
            try {
                propertyResolver = Adapters.collapsedStringAdapterAdapter.marshal(propertyResolverItem);
            } catch (final Exception e) {
                context.xmlAdapterError(facesApplication, "propertyResolver", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (propertyResolver != null) {
                writer.writeStartElement(prefix, "property-resolver", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(propertyResolver);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: variableResolver
    final List<String> variableResolverRaw = facesApplication.variableResolver;
    if (variableResolverRaw != null) {
        for (final String variableResolverItem : variableResolverRaw) {
            String variableResolver = null;
            try {
                variableResolver = Adapters.collapsedStringAdapterAdapter.marshal(variableResolverItem);
            } catch (final Exception e) {
                context.xmlAdapterError(facesApplication, "variableResolver", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (variableResolver != null) {
                writer.writeStartElement(prefix, "variable-resolver", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(variableResolver);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: resourceHandler
    final List<String> resourceHandlerRaw = facesApplication.resourceHandler;
    if (resourceHandlerRaw != null) {
        for (final String resourceHandlerItem : resourceHandlerRaw) {
            String resourceHandler = null;
            try {
                resourceHandler = Adapters.collapsedStringAdapterAdapter.marshal(resourceHandlerItem);
            } catch (final Exception e) {
                context.xmlAdapterError(facesApplication, "resourceHandler", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (resourceHandler != null) {
                writer.writeStartElement(prefix, "resource-handler", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(resourceHandler);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: systemEventListener
    final List<FacesSystemEventListener> systemEventListener = facesApplication.systemEventListener;
    if (systemEventListener != null) {
        for (final FacesSystemEventListener systemEventListenerItem : systemEventListener) {
            if (systemEventListenerItem != null) {
                writer.writeStartElement(prefix, "system-event-listener", "http://java.sun.com/xml/ns/javaee");
                writeFacesSystemEventListener(writer, systemEventListenerItem, context);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: localeConfig
    final List<FacesLocaleConfig> localeConfig = facesApplication.localeConfig;
    if (localeConfig != null) {
        for (final FacesLocaleConfig localeConfigItem : localeConfig) {
            if (localeConfigItem != null) {
                writer.writeStartElement(prefix, "locale-config", "http://java.sun.com/xml/ns/javaee");
                writeFacesLocaleConfig(writer, localeConfigItem, context);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: resourceBundle
    final FacesApplicationResourceBundle resourceBundle = facesApplication.resourceBundle;
    if (resourceBundle != null) {
        writer.writeStartElement(prefix, "resource-bundle", "http://java.sun.com/xml/ns/javaee");
        writeFacesApplicationResourceBundle(writer, resourceBundle, context);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(facesApplication, "resourceBundle");
    }
    // ELEMENT: applicationExtension
    final List<FacesApplicationExtension> applicationExtension = facesApplication.applicationExtension;
    if (applicationExtension != null) {
        for (final FacesApplicationExtension applicationExtensionItem : applicationExtension) {
            if (applicationExtensionItem != null) {
                writer.writeStartElement(prefix, "application-extension", "http://java.sun.com/xml/ns/javaee");
                writeFacesApplicationExtension(writer, applicationExtensionItem, context);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: defaultValidators
    final List<FacesValidator> defaultValidators = facesApplication.defaultValidators;
    if (defaultValidators != null) {
        for (final FacesValidator defaultValidatorsItem : defaultValidators) {
            if (defaultValidatorsItem != null) {
                writer.writeStartElement(prefix, "default-validators", "http://java.sun.com/xml/ns/javaee");
                writeFacesValidator(writer, defaultValidatorsItem, context);
                writer.writeEndElement();
            }
        }
    }
    context.afterMarshal(facesApplication, LifecycleCallback.NONE);
}
Also used : FacesSystemEventListener$JAXB.writeFacesSystemEventListener(org.apache.openejb.jee.FacesSystemEventListener$JAXB.writeFacesSystemEventListener) FacesSystemEventListener$JAXB.readFacesSystemEventListener(org.apache.openejb.jee.FacesSystemEventListener$JAXB.readFacesSystemEventListener) CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) FacesApplicationExtension$JAXB.writeFacesApplicationExtension(org.apache.openejb.jee.FacesApplicationExtension$JAXB.writeFacesApplicationExtension) FacesApplicationExtension$JAXB.readFacesApplicationExtension(org.apache.openejb.jee.FacesApplicationExtension$JAXB.readFacesApplicationExtension) FacesLocaleConfig$JAXB.readFacesLocaleConfig(org.apache.openejb.jee.FacesLocaleConfig$JAXB.readFacesLocaleConfig) FacesLocaleConfig$JAXB.writeFacesLocaleConfig(org.apache.openejb.jee.FacesLocaleConfig$JAXB.writeFacesLocaleConfig) FacesApplicationResourceBundle$JAXB.readFacesApplicationResourceBundle(org.apache.openejb.jee.FacesApplicationResourceBundle$JAXB.readFacesApplicationResourceBundle) FacesApplicationResourceBundle$JAXB.writeFacesApplicationResourceBundle(org.apache.openejb.jee.FacesApplicationResourceBundle$JAXB.writeFacesApplicationResourceBundle) ArrayList(java.util.ArrayList) List(java.util.List) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) FacesValidator$JAXB.readFacesValidator(org.apache.openejb.jee.FacesValidator$JAXB.readFacesValidator) FacesValidator$JAXB.writeFacesValidator(org.apache.openejb.jee.FacesValidator$JAXB.writeFacesValidator)

Example 63 with RuntimeContext

use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.

the class FacesApplicationExtension$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final FacesApplicationExtension facesApplicationExtension, RuntimeContext context) throws Exception {
    if (facesApplicationExtension == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    if (FacesApplicationExtension.class != facesApplicationExtension.getClass()) {
        context.unexpectedSubclass(writer, facesApplicationExtension, FacesApplicationExtension.class);
        return;
    }
    context.beforeMarshal(facesApplicationExtension, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = facesApplicationExtension.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(facesApplicationExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT_REF: any
    final List<Object> any = facesApplicationExtension.any;
    if (any != null) {
        for (final Object anyItem : any) {
            context.writeXmlAny(writer, facesApplicationExtension, "any", anyItem);
        }
    }
    context.afterMarshal(facesApplicationExtension, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) JAXBObject(org.metatype.sxc.jaxb.JAXBObject) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 64 with RuntimeContext

use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.

the class FacesApplicationExtension$JAXB method _read.

public static final FacesApplicationExtension _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final FacesApplicationExtension facesApplicationExtension = new FacesApplicationExtension();
    context.beforeUnmarshal(facesApplicationExtension, LifecycleCallback.NONE);
    List<Object> any = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-application-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesApplicationExtension.class);
        }
    }
    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: id
            final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
            context.addXmlId(reader, id, facesApplicationExtension);
            facesApplicationExtension.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        // ELEMENT_REF: any
        if (any == null) {
            any = facesApplicationExtension.any;
            if (any != null) {
                any.clear();
            } else {
                any = new ArrayList<Object>();
            }
        }
        any.add(context.readXmlAny(elementReader, Object.class, true));
    }
    if (any != null) {
        facesApplicationExtension.any = any;
    }
    context.afterUnmarshal(facesApplicationExtension, LifecycleCallback.NONE);
    return facesApplicationExtension;
}
Also used : Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) JAXBObject(org.metatype.sxc.jaxb.JAXBObject) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 65 with RuntimeContext

use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.

the class FacesAttribute$JAXB method _read.

public static final FacesAttribute _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final FacesAttribute facesAttribute = new FacesAttribute();
    context.beforeUnmarshal(facesAttribute, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    List<FacesAttributeExtension> attributeExtension = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-attributeType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesAttribute.class);
        }
    }
    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: id
            final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
            context.addXmlId(reader, id, facesAttribute);
            facesAttribute.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: descriptions
            final Text descriptionsItem = readText(elementReader, context);
            if (descriptions == null) {
                descriptions = new ArrayList<Text>();
            }
            descriptions.add(descriptionsItem);
        } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: displayNames
            final Text displayNamesItem = readText(elementReader, context);
            if (displayNames == null) {
                displayNames = new ArrayList<Text>();
            }
            displayNames.add(displayNamesItem);
        } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: icon
            final Icon iconItem = readIcon(elementReader, context);
            if (icon == null) {
                icon = facesAttribute.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("attribute-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: attributeName
            final String attributeNameRaw = elementReader.getElementAsString();
            final String attributeName;
            try {
                attributeName = Adapters.collapsedStringAdapterAdapter.unmarshal(attributeNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesAttribute.attributeName = attributeName;
        } else if (("attribute-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: attributeClass
            final String attributeClassRaw = elementReader.getElementAsString();
            final String attributeClass;
            try {
                attributeClass = Adapters.collapsedStringAdapterAdapter.unmarshal(attributeClassRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesAttribute.attributeClass = attributeClass;
        } else if (("default-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: defaultValue
            final String defaultValueRaw = elementReader.getElementAsString();
            final String defaultValue;
            try {
                defaultValue = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultValueRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesAttribute.defaultValue = defaultValue;
        } else if (("suggested-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: suggestedValue
            final String suggestedValueRaw = elementReader.getElementAsString();
            final String suggestedValue;
            try {
                suggestedValue = Adapters.collapsedStringAdapterAdapter.unmarshal(suggestedValueRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesAttribute.suggestedValue = suggestedValue;
        } else if (("attribute-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: attributeExtension
            final FacesAttributeExtension attributeExtensionItem = readFacesAttributeExtension(elementReader, context);
            if (attributeExtension == null) {
                attributeExtension = facesAttribute.attributeExtension;
                if (attributeExtension != null) {
                    attributeExtension.clear();
                } else {
                    attributeExtension = new ArrayList<FacesAttributeExtension>();
                }
            }
            attributeExtension.add(attributeExtensionItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "display-name"), new QName("http://java.sun.com/xml/ns/javaee", "icon"), new QName("http://java.sun.com/xml/ns/javaee", "attribute-name"), new QName("http://java.sun.com/xml/ns/javaee", "attribute-class"), new QName("http://java.sun.com/xml/ns/javaee", "default-value"), new QName("http://java.sun.com/xml/ns/javaee", "suggested-value"), new QName("http://java.sun.com/xml/ns/javaee", "attribute-extension"));
        }
    }
    if (descriptions != null) {
        try {
            facesAttribute.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, FacesAttribute.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            facesAttribute.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, FacesAttribute.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        facesAttribute.icon = icon;
    }
    if (attributeExtension != null) {
        facesAttribute.attributeExtension = attributeExtension;
    }
    context.afterUnmarshal(facesAttribute, LifecycleCallback.NONE);
    return facesAttribute;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) FacesAttributeExtension$JAXB.writeFacesAttributeExtension(org.apache.openejb.jee.FacesAttributeExtension$JAXB.writeFacesAttributeExtension) FacesAttributeExtension$JAXB.readFacesAttributeExtension(org.apache.openejb.jee.FacesAttributeExtension$JAXB.readFacesAttributeExtension) ArrayList(java.util.ArrayList) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Aggregations

RuntimeContext (org.metatype.sxc.jaxb.RuntimeContext)380 CollapsedStringAdapter (javax.xml.bind.annotation.adapters.CollapsedStringAdapter)300 QName (javax.xml.namespace.QName)202 Attribute (org.metatype.sxc.util.Attribute)190 XoXMLStreamReader (org.metatype.sxc.util.XoXMLStreamReader)182 Text$JAXB.readText (org.apache.openejb.jee.Text$JAXB.readText)155 Text$JAXB.writeText (org.apache.openejb.jee.Text$JAXB.writeText)154 ArrayList (java.util.ArrayList)91 Icon$JAXB.readIcon (org.apache.openejb.jee.Icon$JAXB.readIcon)74 Icon$JAXB.writeIcon (org.apache.openejb.jee.Icon$JAXB.writeIcon)74 JAXBObject (org.metatype.sxc.jaxb.JAXBObject)39 List (java.util.List)22 InjectionTarget$JAXB.readInjectionTarget (org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget)18 InjectionTarget$JAXB.writeInjectionTarget (org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget)18 DataSource$JAXB.readDataSource (org.apache.openejb.jee.DataSource$JAXB.readDataSource)14 DataSource$JAXB.writeDataSource (org.apache.openejb.jee.DataSource$JAXB.writeDataSource)14 EjbLocalRef$JAXB.readEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef)14 EjbLocalRef$JAXB.writeEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef)14 EjbRef$JAXB.readEjbRef (org.apache.openejb.jee.EjbRef$JAXB.readEjbRef)14 EjbRef$JAXB.writeEjbRef (org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef)14