in container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesComponent$JAXB.java [76:272]
public static final FacesComponent _read(XoXMLStreamReader reader, RuntimeContext context)
throws Exception
{
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
FacesComponent facesComponent = new FacesComponent();
context.beforeUnmarshal(facesComponent, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
ArrayList<Text> displayNames = null;
LocalCollection<Icon> icon = null;
List<FacesFacet> facet = null;
List<FacesAttribute> attribute1 = null;
List<FacesProperty> property = null;
List<FacesComponentExtension> componentExtension = null;
List<Object> others = null;
// Check xsi:type
QName xsiType = reader.getXsiType();
if (xsiType!= null) {
if (("faces-config-componentType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, FacesComponent.class);
}
}
// Read attributes
for (Attribute attribute: reader.getAttributes()) {
if (("id" == attribute.getLocalName())&&(("" == attribute.getNamespace())||(attribute.getNamespace() == null))) {
// ATTRIBUTE: id
String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
context.addXmlId(reader, id, facesComponent);
facesComponent.id = id;
} else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
context.unexpectedAttribute(attribute, new QName("", "id"));
}
}
// Read elements
for (XoXMLStreamReader elementReader: reader.getChildElements()) {
if (("description" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: descriptions
Text descriptionsItem = readText(elementReader, context);
if (descriptions == null) {
descriptions = new ArrayList<>();
}
descriptions.add(descriptionsItem);
} else if (("display-name" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: displayNames
Text displayNamesItem = readText(elementReader, context);
if (displayNames == null) {
displayNames = new ArrayList<>();
}
displayNames.add(displayNamesItem);
} else if (("icon" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: icon
Icon iconItem = readIcon(elementReader, context);
if (icon == null) {
icon = facesComponent.icon;
if (icon!= null) {
icon.clear();
} else {
icon = new LocalCollection<>();
}
}
icon.add(iconItem);
} else if (("component-type" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: componentType
String componentTypeRaw = elementReader.getElementText();
String componentType;
try {
componentType = Adapters.collapsedStringAdapterAdapter.unmarshal(componentTypeRaw);
} catch (Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesComponent.componentType = componentType;
} else if (("component-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: componentClass
String componentClassRaw = elementReader.getElementText();
String componentClass;
try {
componentClass = Adapters.collapsedStringAdapterAdapter.unmarshal(componentClassRaw);
} catch (Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesComponent.componentClass = componentClass;
} else if (("facet" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: facet
FacesFacet facetItem = readFacesFacet(elementReader, context);
if (facet == null) {
facet = facesComponent.facet;
if (facet!= null) {
facet.clear();
} else {
facet = new ArrayList<>();
}
}
facet.add(facetItem);
} else if (("attribute" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: attribute
FacesAttribute attributeItem = readFacesAttribute(elementReader, context);
if (attribute1 == null) {
attribute1 = facesComponent.attribute;
if (attribute1 != null) {
attribute1 .clear();
} else {
attribute1 = new ArrayList<>();
}
}
attribute1 .add(attributeItem);
} else if (("property" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: property
FacesProperty propertyItem = readFacesProperty(elementReader, context);
if (property == null) {
property = facesComponent.property;
if (property!= null) {
property.clear();
} else {
property = new ArrayList<>();
}
}
property.add(propertyItem);
} else if (("component-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: componentExtension
FacesComponentExtension componentExtensionItem = readFacesComponentExtension(elementReader, context);
if (componentExtension == null) {
componentExtension = facesComponent.componentExtension;
if (componentExtension!= null) {
componentExtension.clear();
} else {
componentExtension = new ArrayList<>();
}
}
componentExtension.add(componentExtensionItem);
} else {
// ELEMENT_REF: others
if (others == null) {
others = facesComponent.others;
if (others!= null) {
others.clear();
} else {
others = new ArrayList<>();
}
}
others.add(context.readXmlAny(elementReader, Object.class, false));
}
}
if (descriptions!= null) {
try {
facesComponent.setDescriptions(descriptions.toArray(new Text[descriptions.size()] ));
} catch (Exception e) {
context.setterError(reader, FacesComponent.class, "setDescriptions", Text[].class, e);
}
}
if (displayNames!= null) {
try {
facesComponent.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] ));
} catch (Exception e) {
context.setterError(reader, FacesComponent.class, "setDisplayNames", Text[].class, e);
}
}
if (icon!= null) {
facesComponent.icon = icon;
}
if (facet!= null) {
facesComponent.facet = facet;
}
if (attribute1 != null) {
facesComponent.attribute = attribute1;
}
if (property!= null) {
facesComponent.property = property;
}
if (componentExtension!= null) {
facesComponent.componentExtension = componentExtension;
}
if (others!= null) {
facesComponent.others = others;
}
context.afterUnmarshal(facesComponent, LifecycleCallback.NONE);
return facesComponent;
}