Search in sources :

Example 21 with Icon$JAXB.writeIcon

use of org.apache.openejb.jee.Icon$JAXB.writeIcon in project tomee by apache.

the class Webservices$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final Webservices webservices, RuntimeContext context) throws Exception {
    if (webservices == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Webservices.class != webservices.getClass()) {
        context.unexpectedSubclass(writer, webservices, Webservices.class);
        return;
    }
    context.beforeMarshal(webservices, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = webservices.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(webservices, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ATTRIBUTE: version
    final String versionRaw = webservices.version;
    if (versionRaw != null) {
        String version = null;
        try {
            version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(webservices, "version", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "version", version);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = webservices.getDescriptions();
    } catch (final Exception e) {
        context.getterError(webservices, "descriptions", Webservices.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(webservices, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = webservices.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(webservices, "displayNames", Webservices.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
        for (final Text displayNamesItem : displayNames) {
            if (displayNamesItem != null) {
                writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, displayNamesItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(webservices, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = webservices.icon;
    if (icon != null) {
        for (final Icon iconItem : icon) {
            if (iconItem != null) {
                writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
                writeIcon(writer, iconItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(webservices, "icon");
            }
        }
    }
    // ELEMENT: webserviceDescription
    final KeyedCollection<String, WebserviceDescription> webserviceDescription = webservices.webserviceDescription;
    if (webserviceDescription != null) {
        for (final WebserviceDescription webserviceDescriptionItem : webserviceDescription) {
            if (webserviceDescriptionItem != null) {
                writer.writeStartElement(prefix, "webservice-description", "http://java.sun.com/xml/ns/javaee");
                writeWebserviceDescription(writer, webserviceDescriptionItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(webservices, "webserviceDescription");
            }
        }
    }
    context.afterMarshal(webservices, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) WebserviceDescription$JAXB.writeWebserviceDescription(org.apache.openejb.jee.WebserviceDescription$JAXB.writeWebserviceDescription) WebserviceDescription$JAXB.readWebserviceDescription(org.apache.openejb.jee.WebserviceDescription$JAXB.readWebserviceDescription) 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)

Example 22 with Icon$JAXB.writeIcon

use of org.apache.openejb.jee.Icon$JAXB.writeIcon in project tomee by apache.

the class Tag$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final Tag tag, RuntimeContext context) throws Exception {
    if (tag == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Tag.class != tag.getClass()) {
        context.unexpectedSubclass(writer, tag, Tag.class);
        return;
    }
    context.beforeMarshal(tag, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = tag.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(tag, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = tag.getDescriptions();
    } catch (final Exception e) {
        context.getterError(tag, "descriptions", Tag.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(tag, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = tag.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(tag, "displayNames", Tag.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
        for (final Text displayNamesItem : displayNames) {
            if (displayNamesItem != null) {
                writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, displayNamesItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(tag, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = tag.icon;
    if (icon != null) {
        for (final Icon iconItem : icon) {
            if (iconItem != null) {
                writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
                writeIcon(writer, iconItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(tag, "icon");
            }
        }
    }
    // ELEMENT: name
    final String nameRaw = tag.name;
    String name = null;
    try {
        name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(tag, "name", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (name != null) {
        writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(name);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(tag, "name");
    }
    // ELEMENT: tagClass
    final String tagClassRaw = tag.tagClass;
    String tagClass = null;
    try {
        tagClass = Adapters.collapsedStringAdapterAdapter.marshal(tagClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(tag, "tagClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (tagClass != null) {
        writer.writeStartElement(prefix, "tag-class", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(tagClass);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(tag, "tagClass");
    }
    // ELEMENT: teiClass
    final String teiClassRaw = tag.teiClass;
    String teiClass = null;
    try {
        teiClass = Adapters.collapsedStringAdapterAdapter.marshal(teiClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(tag, "teiClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (teiClass != null) {
        writer.writeStartElement(prefix, "tei-class", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(teiClass);
        writer.writeEndElement();
    }
    // ELEMENT: bodyContent
    final BodyContent bodyContent = tag.bodyContent;
    if (bodyContent != null) {
        writer.writeStartElement(prefix, "body-content", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(toStringBodyContent(tag, null, context, bodyContent));
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(tag, "bodyContent");
    }
    // ELEMENT: variable
    final List<Variable> variable = tag.variable;
    if (variable != null) {
        for (final Variable variableItem : variable) {
            writer.writeStartElement(prefix, "variable", "http://java.sun.com/xml/ns/javaee");
            if (variableItem != null) {
                writeVariable(writer, variableItem, context);
            } else {
                writer.writeXsiNil();
            }
            writer.writeEndElement();
        }
    }
    // ELEMENT: attribute
    final List<TldAttribute> attribute = tag.attribute;
    if (attribute != null) {
        for (final TldAttribute attributeItem : attribute) {
            writer.writeStartElement(prefix, "attribute", "http://java.sun.com/xml/ns/javaee");
            if (attributeItem != null) {
                writeTldAttribute(writer, attributeItem, context);
            } else {
                writer.writeXsiNil();
            }
            writer.writeEndElement();
        }
    }
    // ELEMENT: dynamicAttributes
    final String dynamicAttributesRaw = tag.dynamicAttributes;
    String dynamicAttributes = null;
    try {
        dynamicAttributes = Adapters.collapsedStringAdapterAdapter.marshal(dynamicAttributesRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(tag, "dynamicAttributes", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (dynamicAttributes != null) {
        writer.writeStartElement(prefix, "dynamic-attributes", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(dynamicAttributes);
        writer.writeEndElement();
    }
    // ELEMENT: example
    final String exampleRaw = tag.example;
    String example = null;
    try {
        example = Adapters.collapsedStringAdapterAdapter.marshal(exampleRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(tag, "example", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (example != null) {
        writer.writeStartElement(prefix, "example", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(example);
        writer.writeEndElement();
    }
    // ELEMENT: tagExtension
    final List<TldExtension> tagExtension = tag.tagExtension;
    if (tagExtension != null) {
        for (final TldExtension tagExtensionItem : tagExtension) {
            if (tagExtensionItem != null) {
                writer.writeStartElement(prefix, "tag-extension", "http://java.sun.com/xml/ns/javaee");
                writeTldExtension(writer, tagExtensionItem, context);
                writer.writeEndElement();
            }
        }
    }
    context.afterMarshal(tag, LifecycleCallback.NONE);
}
Also used : Variable$JAXB.readVariable(org.apache.openejb.jee.Variable$JAXB.readVariable) Variable$JAXB.writeVariable(org.apache.openejb.jee.Variable$JAXB.writeVariable) 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) BodyContent$JAXB.parseBodyContent(org.apache.openejb.jee.BodyContent$JAXB.parseBodyContent) BodyContent$JAXB.toStringBodyContent(org.apache.openejb.jee.BodyContent$JAXB.toStringBodyContent) TldExtension$JAXB.readTldExtension(org.apache.openejb.jee.TldExtension$JAXB.readTldExtension) TldExtension$JAXB.writeTldExtension(org.apache.openejb.jee.TldExtension$JAXB.writeTldExtension) 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) TldAttribute$JAXB.readTldAttribute(org.apache.openejb.jee.TldAttribute$JAXB.readTldAttribute) TldAttribute$JAXB.writeTldAttribute(org.apache.openejb.jee.TldAttribute$JAXB.writeTldAttribute)

Example 23 with Icon$JAXB.writeIcon

use of org.apache.openejb.jee.Icon$JAXB.writeIcon in project tomee by apache.

the class WebserviceDescription$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final WebserviceDescription webserviceDescription, RuntimeContext context) throws Exception {
    if (webserviceDescription == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (WebserviceDescription.class != webserviceDescription.getClass()) {
        context.unexpectedSubclass(writer, webserviceDescription, WebserviceDescription.class);
        return;
    }
    context.beforeMarshal(webserviceDescription, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = webserviceDescription.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(webserviceDescription, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: description
    final String descriptionRaw = webserviceDescription.description;
    String description = null;
    try {
        description = Adapters.collapsedStringAdapterAdapter.marshal(descriptionRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(webserviceDescription, "description", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (description != null) {
        writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(description);
        writer.writeEndElement();
    }
    // ELEMENT: displayName
    final String displayNameRaw = webserviceDescription.displayName;
    String displayName = null;
    try {
        displayName = Adapters.collapsedStringAdapterAdapter.marshal(displayNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(webserviceDescription, "displayName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (displayName != null) {
        writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(displayName);
        writer.writeEndElement();
    }
    // ELEMENT: icon
    final Icon icon = webserviceDescription.icon;
    if (icon != null) {
        writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
        writeIcon(writer, icon, context);
        writer.writeEndElement();
    }
    // ELEMENT: webserviceDescriptionName
    final String webserviceDescriptionNameRaw = webserviceDescription.webserviceDescriptionName;
    String webserviceDescriptionName = null;
    try {
        webserviceDescriptionName = Adapters.collapsedStringAdapterAdapter.marshal(webserviceDescriptionNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(webserviceDescription, "webserviceDescriptionName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (webserviceDescriptionName != null) {
        writer.writeStartElement(prefix, "webservice-description-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(webserviceDescriptionName);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(webserviceDescription, "webserviceDescriptionName");
    }
    // ELEMENT: wsdlFile
    final String wsdlFileRaw = webserviceDescription.wsdlFile;
    String wsdlFile = null;
    try {
        wsdlFile = Adapters.collapsedStringAdapterAdapter.marshal(wsdlFileRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(webserviceDescription, "wsdlFile", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (wsdlFile != null) {
        writer.writeStartElement(prefix, "wsdl-file", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(wsdlFile);
        writer.writeEndElement();
    }
    // ELEMENT: jaxrpcMappingFile
    final String jaxrpcMappingFileRaw = webserviceDescription.jaxrpcMappingFile;
    String jaxrpcMappingFile = null;
    try {
        jaxrpcMappingFile = Adapters.collapsedStringAdapterAdapter.marshal(jaxrpcMappingFileRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(webserviceDescription, "jaxrpcMappingFile", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (jaxrpcMappingFile != null) {
        writer.writeStartElement(prefix, "jaxrpc-mapping-file", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(jaxrpcMappingFile);
        writer.writeEndElement();
    }
    // ELEMENT: portComponent
    final KeyedCollection<String, PortComponent> portComponent = webserviceDescription.portComponent;
    if (portComponent != null) {
        for (final PortComponent portComponentItem : portComponent) {
            if (portComponentItem != null) {
                writer.writeStartElement(prefix, "port-component", "http://java.sun.com/xml/ns/javaee");
                writePortComponent(writer, portComponentItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(webserviceDescription, "portComponent");
            }
        }
    }
    context.afterMarshal(webserviceDescription, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) PortComponent$JAXB.readPortComponent(org.apache.openejb.jee.PortComponent$JAXB.readPortComponent) PortComponent$JAXB.writePortComponent(org.apache.openejb.jee.PortComponent$JAXB.writePortComponent) 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)

Example 24 with Icon$JAXB.writeIcon

use of org.apache.openejb.jee.Icon$JAXB.writeIcon in project tomee by apache.

the class Listener$JAXB method _read.

public static final Listener _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final Listener listener = new Listener();
    context.beforeUnmarshal(listener, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("listenerType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, Listener.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, listener);
            listener.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 = listener.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("listener-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: listenerClass
            final String listenerClassRaw = elementReader.getElementAsString();
            final String listenerClass;
            try {
                listenerClass = Adapters.collapsedStringAdapterAdapter.unmarshal(listenerClassRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            listener.listenerClass = listenerClass;
        } 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", "listener-class"));
        }
    }
    if (descriptions != null) {
        try {
            listener.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, Listener.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            listener.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, Listener.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        listener.icon = icon;
    }
    context.afterUnmarshal(listener, LifecycleCallback.NONE);
    return listener;
}
Also used : Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) 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)

Example 25 with Icon$JAXB.writeIcon

use of org.apache.openejb.jee.Icon$JAXB.writeIcon in project tomee by apache.

the class Listener$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final Listener listener, RuntimeContext context) throws Exception {
    if (listener == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Listener.class != listener.getClass()) {
        context.unexpectedSubclass(writer, listener, Listener.class);
        return;
    }
    context.beforeMarshal(listener, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = listener.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(listener, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = listener.getDescriptions();
    } catch (final Exception e) {
        context.getterError(listener, "descriptions", Listener.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(listener, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = listener.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(listener, "displayNames", Listener.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
        for (final Text displayNamesItem : displayNames) {
            if (displayNamesItem != null) {
                writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, displayNamesItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(listener, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = listener.icon;
    if (icon != null) {
        for (final Icon iconItem : icon) {
            if (iconItem != null) {
                writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
                writeIcon(writer, iconItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(listener, "icon");
            }
        }
    }
    // ELEMENT: listenerClass
    final String listenerClassRaw = listener.listenerClass;
    String listenerClass = null;
    try {
        listenerClass = Adapters.collapsedStringAdapterAdapter.marshal(listenerClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(listener, "listenerClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (listenerClass != null) {
        writer.writeStartElement(prefix, "listener-class", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(listenerClass);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(listener, "listenerClass");
    }
    context.afterMarshal(listener, 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) 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)

Aggregations

Icon$JAXB.readIcon (org.apache.openejb.jee.Icon$JAXB.readIcon)74 Icon$JAXB.writeIcon (org.apache.openejb.jee.Icon$JAXB.writeIcon)74 RuntimeContext (org.metatype.sxc.jaxb.RuntimeContext)74 CollapsedStringAdapter (javax.xml.bind.annotation.adapters.CollapsedStringAdapter)70 Text$JAXB.readText (org.apache.openejb.jee.Text$JAXB.readText)70 Text$JAXB.writeText (org.apache.openejb.jee.Text$JAXB.writeText)70 ArrayList (java.util.ArrayList)40 QName (javax.xml.namespace.QName)40 Attribute (org.metatype.sxc.util.Attribute)37 XoXMLStreamReader (org.metatype.sxc.util.XoXMLStreamReader)37 DataSource$JAXB.readDataSource (org.apache.openejb.jee.DataSource$JAXB.readDataSource)12 DataSource$JAXB.writeDataSource (org.apache.openejb.jee.DataSource$JAXB.writeDataSource)12 EjbLocalRef$JAXB.readEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef)12 EjbLocalRef$JAXB.writeEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef)12 EjbRef$JAXB.readEjbRef (org.apache.openejb.jee.EjbRef$JAXB.readEjbRef)12 EjbRef$JAXB.writeEjbRef (org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef)12 EnvEntry$JAXB.readEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry)12 EnvEntry$JAXB.writeEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry)12 MessageDestinationRef$JAXB.readMessageDestinationRef (org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef)12 MessageDestinationRef$JAXB.writeMessageDestinationRef (org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef)12