use of org.metatype.sxc.util.Attribute in project tomee by apache.
the class FacesLocaleConfig$JAXB method _read.
public static final FacesLocaleConfig _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final FacesLocaleConfig facesLocaleConfig = new FacesLocaleConfig();
context.beforeUnmarshal(facesLocaleConfig, LifecycleCallback.NONE);
List<FacesSupportedLocale> supportedLocale = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("faces-config-locale-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, FacesLocaleConfig.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, facesLocaleConfig);
facesLocaleConfig.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 (("default-locale" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: defaultLocale
final FacesDefaultLocale defaultLocale = readFacesDefaultLocale(elementReader, context);
facesLocaleConfig.defaultLocale = defaultLocale;
} else if (("supported-locale" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: supportedLocale
final FacesSupportedLocale supportedLocaleItem = readFacesSupportedLocale(elementReader, context);
if (supportedLocale == null) {
supportedLocale = facesLocaleConfig.supportedLocale;
if (supportedLocale != null) {
supportedLocale.clear();
} else {
supportedLocale = new ArrayList<FacesSupportedLocale>();
}
}
supportedLocale.add(supportedLocaleItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "default-locale"), new QName("http://java.sun.com/xml/ns/javaee", "supported-locale"));
}
}
if (supportedLocale != null) {
facesLocaleConfig.supportedLocale = supportedLocale;
}
context.afterUnmarshal(facesLocaleConfig, LifecycleCallback.NONE);
return facesLocaleConfig;
}
use of org.metatype.sxc.util.Attribute 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.util.Attribute 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.util.Attribute 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;
}
use of org.metatype.sxc.util.Attribute in project tomee by apache.
the class ActivationConfig$JAXB method _read.
public static final ActivationConfig _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final ActivationConfig activationConfig = new ActivationConfig();
context.beforeUnmarshal(activationConfig, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
List<ActivationConfigProperty> activationConfigProperty = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("activation-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, ActivationConfig.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, activationConfig);
activationConfig.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 (("activation-config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: activationConfigProperty
final ActivationConfigProperty activationConfigPropertyItem = readActivationConfigProperty(elementReader, context);
if (activationConfigProperty == null) {
activationConfigProperty = activationConfig.activationConfigProperty;
if (activationConfigProperty != null) {
activationConfigProperty.clear();
} else {
activationConfigProperty = new ArrayList<ActivationConfigProperty>();
}
}
activationConfigProperty.add(activationConfigPropertyItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "activation-config-property"));
}
}
if (descriptions != null) {
try {
activationConfig.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, ActivationConfig.class, "setDescriptions", Text[].class, e);
}
}
if (activationConfigProperty != null) {
activationConfig.activationConfigProperty = activationConfigProperty;
}
context.afterUnmarshal(activationConfig, LifecycleCallback.NONE);
return activationConfig;
}
Aggregations