use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.
the class FacesManagedBean$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final FacesManagedBean facesManagedBean, RuntimeContext context) throws Exception {
if (facesManagedBean == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (FacesManagedBean.class != facesManagedBean.getClass()) {
context.unexpectedSubclass(writer, facesManagedBean, FacesManagedBean.class);
return;
}
context.beforeMarshal(facesManagedBean, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = facesManagedBean.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesManagedBean, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = facesManagedBean.getDescriptions();
} catch (final Exception e) {
context.getterError(facesManagedBean, "descriptions", FacesManagedBean.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(facesManagedBean, "descriptions");
}
}
}
// ELEMENT: displayNames
Text[] displayNames = null;
try {
displayNames = facesManagedBean.getDisplayNames();
} catch (final Exception e) {
context.getterError(facesManagedBean, "displayNames", FacesManagedBean.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(facesManagedBean, "displayNames");
}
}
}
// ELEMENT: icon
final LocalCollection<Icon> icon = facesManagedBean.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(facesManagedBean, "icon");
}
}
}
// ELEMENT: managedBeanName
final String managedBeanNameRaw = facesManagedBean.managedBeanName;
String managedBeanName = null;
try {
managedBeanName = Adapters.collapsedStringAdapterAdapter.marshal(managedBeanNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesManagedBean, "managedBeanName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (managedBeanName != null) {
writer.writeStartElement(prefix, "managed-bean-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(managedBeanName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesManagedBean, "managedBeanName");
}
// ELEMENT: managedBeanClass
final String managedBeanClassRaw = facesManagedBean.managedBeanClass;
String managedBeanClass = null;
try {
managedBeanClass = Adapters.collapsedStringAdapterAdapter.marshal(managedBeanClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesManagedBean, "managedBeanClass", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (managedBeanClass != null) {
writer.writeStartElement(prefix, "managed-bean-class", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(managedBeanClass);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesManagedBean, "managedBeanClass");
}
// ELEMENT: managedBeanScope
final String managedBeanScopeRaw = facesManagedBean.managedBeanScope;
String managedBeanScope = null;
try {
managedBeanScope = Adapters.collapsedStringAdapterAdapter.marshal(managedBeanScopeRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesManagedBean, "managedBeanScope", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (managedBeanScope != null) {
writer.writeStartElement(prefix, "managed-bean-scope", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(managedBeanScope);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesManagedBean, "managedBeanScope");
}
// ELEMENT: managedProperty
final List<FacesManagedProperty> managedProperty = facesManagedBean.managedProperty;
if (managedProperty != null) {
for (final FacesManagedProperty managedPropertyItem : managedProperty) {
if (managedPropertyItem != null) {
writer.writeStartElement(prefix, "managed-property", "http://java.sun.com/xml/ns/javaee");
writeFacesManagedProperty(writer, managedPropertyItem, context);
writer.writeEndElement();
}
}
}
// ELEMENT: mapEntries
final FacesMapEntries mapEntries = facesManagedBean.mapEntries;
if (mapEntries != null) {
writer.writeStartElement(prefix, "map-entries", "http://java.sun.com/xml/ns/javaee");
writeFacesMapEntries(writer, mapEntries, context);
writer.writeEndElement();
}
// ELEMENT: listEntries
final FacesListEntries listEntries = facesManagedBean.listEntries;
if (listEntries != null) {
writer.writeStartElement(prefix, "list-entries", "http://java.sun.com/xml/ns/javaee");
writeFacesListEntries(writer, listEntries, context);
writer.writeEndElement();
}
// ELEMENT: managedBeanExtension
final List<FacesManagedBeanExtension> managedBeanExtension = facesManagedBean.managedBeanExtension;
if (managedBeanExtension != null) {
for (final FacesManagedBeanExtension managedBeanExtensionItem : managedBeanExtension) {
if (managedBeanExtensionItem != null) {
writer.writeStartElement(prefix, "managed-bean-extension", "http://java.sun.com/xml/ns/javaee");
writeFacesManagedBeanExtension(writer, managedBeanExtensionItem, context);
writer.writeEndElement();
}
}
}
context.afterMarshal(facesManagedBean, LifecycleCallback.NONE);
}
use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.
the class FacesManagedBeanExtension$JAXB method _read.
public static final FacesManagedBeanExtension _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final FacesManagedBeanExtension facesManagedBeanExtension = new FacesManagedBeanExtension();
context.beforeUnmarshal(facesManagedBeanExtension, LifecycleCallback.NONE);
List<Object> any = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("faces-config-managed-bean-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, FacesManagedBeanExtension.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, facesManagedBeanExtension);
facesManagedBeanExtension.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 = facesManagedBeanExtension.any;
if (any != null) {
any.clear();
} else {
any = new ArrayList<Object>();
}
}
any.add(context.readXmlAny(elementReader, Object.class, true));
}
if (any != null) {
facesManagedBeanExtension.any = any;
}
context.afterUnmarshal(facesManagedBeanExtension, LifecycleCallback.NONE);
return facesManagedBeanExtension;
}
use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.
the class FacesManagedBeanExtension$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final FacesManagedBeanExtension facesManagedBeanExtension, RuntimeContext context) throws Exception {
if (facesManagedBeanExtension == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
if (FacesManagedBeanExtension.class != facesManagedBeanExtension.getClass()) {
context.unexpectedSubclass(writer, facesManagedBeanExtension, FacesManagedBeanExtension.class);
return;
}
context.beforeMarshal(facesManagedBeanExtension, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = facesManagedBeanExtension.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesManagedBeanExtension, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT_REF: any
final List<Object> any = facesManagedBeanExtension.any;
if (any != null) {
for (final Object anyItem : any) {
context.writeXmlAny(writer, facesManagedBeanExtension, "any", anyItem);
}
}
context.afterMarshal(facesManagedBeanExtension, LifecycleCallback.NONE);
}
use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.
the class FacesManagedProperty$JAXB method _read.
public static final FacesManagedProperty _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final FacesManagedProperty facesManagedProperty = new FacesManagedProperty();
context.beforeUnmarshal(facesManagedProperty, 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 (("faces-config-managed-propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, FacesManagedProperty.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, facesManagedProperty);
facesManagedProperty.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 = facesManagedProperty.icon;
if (icon != null) {
icon.clear();
} else {
icon = new LocalCollection<Icon>();
}
}
icon.add(iconItem);
} else if (("property-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: propertyName
final String propertyNameRaw = elementReader.getElementAsString();
final String propertyName;
try {
propertyName = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesManagedProperty.propertyName = propertyName;
} else if (("property-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: propertyClass
final String propertyClassRaw = elementReader.getElementAsString();
final String propertyClass;
try {
propertyClass = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesManagedProperty.propertyClass = propertyClass;
} else if (("map-entries" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: mapEntries
final FacesMapEntries mapEntries = readFacesMapEntries(elementReader, context);
facesManagedProperty.mapEntries = mapEntries;
} else if (("null-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: nullValue
final FacesNullValue nullValue = readFacesNullValue(elementReader, context);
facesManagedProperty.nullValue = nullValue;
} else if (("value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: value
final String valueRaw = elementReader.getElementAsString();
final String value;
try {
value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesManagedProperty.value = value;
} else if (("list-entries" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: listEntries
final FacesListEntries listEntries = readFacesListEntries(elementReader, context);
facesManagedProperty.listEntries = listEntries;
} 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", "property-name"), new QName("http://java.sun.com/xml/ns/javaee", "property-class"), new QName("http://java.sun.com/xml/ns/javaee", "map-entries"), new QName("http://java.sun.com/xml/ns/javaee", "null-value"), new QName("http://java.sun.com/xml/ns/javaee", "value"), new QName("http://java.sun.com/xml/ns/javaee", "list-entries"));
}
}
if (descriptions != null) {
try {
facesManagedProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, FacesManagedProperty.class, "setDescriptions", Text[].class, e);
}
}
if (displayNames != null) {
try {
facesManagedProperty.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
} catch (final Exception e) {
context.setterError(reader, FacesManagedProperty.class, "setDisplayNames", Text[].class, e);
}
}
if (icon != null) {
facesManagedProperty.icon = icon;
}
context.afterUnmarshal(facesManagedProperty, LifecycleCallback.NONE);
return facesManagedProperty;
}
use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.
the class AbsoluteOrdering$JAXB method _read.
public static final AbsoluteOrdering _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final AbsoluteOrdering absoluteOrdering = new AbsoluteOrdering();
context.beforeUnmarshal(absoluteOrdering, LifecycleCallback.NONE);
List<Object> nameOrOthers = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("absoluteOrderingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, AbsoluteOrdering.class);
}
}
// Read attributes
for (final Attribute attribute : reader.getAttributes()) {
if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
context.unexpectedAttribute(attribute);
}
}
// Read elements
for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: nameOrOthers
final java.lang.String nameOrOthersItem = elementReader.getElementAsString();
if (nameOrOthers == null) {
nameOrOthers = absoluteOrdering.nameOrOthers;
if (nameOrOthers != null) {
nameOrOthers.clear();
} else {
nameOrOthers = new ArrayList<Object>();
}
}
nameOrOthers.add(nameOrOthersItem);
} else if (("others" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: nameOrOthers
final org.apache.openejb.jee.OrderingOthers nameOrOthersItem1 = readOrderingOthers(elementReader, context);
if (nameOrOthers == null) {
nameOrOthers = absoluteOrdering.nameOrOthers;
if (nameOrOthers != null) {
nameOrOthers.clear();
} else {
nameOrOthers = new ArrayList<Object>();
}
}
nameOrOthers.add(nameOrOthersItem1);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "others"));
}
}
if (nameOrOthers != null) {
absoluteOrdering.nameOrOthers = nameOrOthers;
}
context.afterUnmarshal(absoluteOrdering, LifecycleCallback.NONE);
return absoluteOrdering;
}
Aggregations