in container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/FacesBehavior$JAXB.java [74:249]
public static final FacesBehavior _read(XoXMLStreamReader reader, RuntimeContext context)
throws Exception
{
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
FacesBehavior facesBehavior = new FacesBehavior();
context.beforeUnmarshal(facesBehavior, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
ArrayList<Text> displayNames = null;
LocalCollection<Icon> icon = null;
List<FacesAttribute> attribute1 = null;
List<FacesProperty> property = null;
List<FacesBehaviorExtension> behaviorExtension = null;
List<Object> others = null;
// Check xsi:type
QName xsiType = reader.getXsiType();
if (xsiType!= null) {
if (("faces-config-behaviorType"!= xsiType.getLocalPart())||("http://java.sun.com/xml/ns/javaee"!= xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, FacesBehavior.class);
}
}
// Read attributes
for (Attribute attribute: reader.getAttributes()) {
if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI!= attribute.getNamespace()) {
context.unexpectedAttribute(attribute);
}
}
// 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 = facesBehavior.icon;
if (icon!= null) {
icon.clear();
} else {
icon = new LocalCollection<>();
}
}
icon.add(iconItem);
} else if (("behavior-id" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: behaviorId
String behaviorIdRaw = elementReader.getElementText();
String behaviorId;
try {
behaviorId = Adapters.collapsedStringAdapterAdapter.unmarshal(behaviorIdRaw);
} catch (Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesBehavior.behaviorId = behaviorId;
} else if (("behavior-class" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: behaviorClass
String behaviorClassRaw = elementReader.getElementText();
String behaviorClass;
try {
behaviorClass = Adapters.collapsedStringAdapterAdapter.unmarshal(behaviorClassRaw);
} catch (Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesBehavior.behaviorClass = behaviorClass;
} 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 = facesBehavior.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 = facesBehavior.property;
if (property!= null) {
property.clear();
} else {
property = new ArrayList<>();
}
}
property.add(propertyItem);
} else if (("behavior-extension" == elementReader.getLocalName())&&("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: behaviorExtension
FacesBehaviorExtension behaviorExtensionItem = readFacesBehaviorExtension(elementReader, context);
if (behaviorExtension == null) {
behaviorExtension = facesBehavior.behaviorExtension;
if (behaviorExtension!= null) {
behaviorExtension.clear();
} else {
behaviorExtension = new ArrayList<>();
}
}
behaviorExtension.add(behaviorExtensionItem);
} else {
// ELEMENT_REF: others
if (others == null) {
others = facesBehavior.others;
if (others!= null) {
others.clear();
} else {
others = new ArrayList<>();
}
}
others.add(context.readXmlAny(elementReader, Object.class, false));
}
}
if (descriptions!= null) {
try {
facesBehavior.setDescriptions(descriptions.toArray(new Text[descriptions.size()] ));
} catch (Exception e) {
context.setterError(reader, FacesBehavior.class, "setDescriptions", Text[].class, e);
}
}
if (displayNames!= null) {
try {
facesBehavior.setDisplayNames(displayNames.toArray(new Text[displayNames.size()] ));
} catch (Exception e) {
context.setterError(reader, FacesBehavior.class, "setDisplayNames", Text[].class, e);
}
}
if (icon!= null) {
facesBehavior.icon = icon;
}
if (attribute1 != null) {
facesBehavior.attribute = attribute1;
}
if (property!= null) {
facesBehavior.property = property;
}
if (behaviorExtension!= null) {
facesBehavior.behaviorExtension = behaviorExtension;
}
if (others!= null) {
facesBehavior.others = others;
}
context.afterUnmarshal(facesBehavior, LifecycleCallback.NONE);
return facesBehavior;
}