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);
}
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);
}
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);
}
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;
}
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;
}
Aggregations