public static final Timer _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception { // Check for xsi:nil if (reader.isXsiNil()) { return null; } if (context == null) { context = new RuntimeContext(); } final Timer timer = new Timer(); context.beforeUnmarshal(timer, LifecycleCallback.NONE); ArrayList<Text> descriptions = null; // Check xsi:type final QName xsiType = reader.getXsiType(); if (xsiType != null) { if (("timerType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) { return context.unexpectedXsiType(reader, Timer.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, timer); timer.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 (("schedule" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: schedule final TimerSchedule schedule = readTimerSchedule(elementReader, context); timer.schedule = schedule; } else if (("start" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: start final XMLGregorianCalendar start = datatypeFactory.newXMLGregorianCalendar(elementReader.getElementAsString()); timer.start = start; } else if (("end" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: end final XMLGregorianCalendar end = datatypeFactory.newXMLGregorianCalendar(elementReader.getElementAsString()); timer.end = end; } else if (("timeout-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: timeoutMethod final NamedMethod timeoutMethod = readNamedMethod(elementReader, context); timer.timeoutMethod = timeoutMethod; } else if (("persistent" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: persistent final Boolean persistent = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString())); timer.persistent = persistent; } else if (("timezone" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: timezone final String timezoneRaw = elementReader.getElementAsString(); final String timezone; try { timezone = Adapters.collapsedStringAdapterAdapter.unmarshal(timezoneRaw); } catch (final Exception e) { context.xmlAdapterError( elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } timer.timezone = timezone; } else if (("info" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) { // ELEMENT: info final String infoRaw = elementReader.getElementAsString(); final String info; try { info = Adapters.collapsedStringAdapterAdapter.unmarshal(infoRaw); } catch (final Exception e) { context.xmlAdapterError( elementReader, CollapsedStringAdapter.class, String.class, String.class, e); continue; } timer.info = info; } else { context.unexpectedElement( elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "schedule"), new QName("http://java.sun.com/xml/ns/javaee", "start"), new QName("http://java.sun.com/xml/ns/javaee", "end"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "persistent"), new QName("http://java.sun.com/xml/ns/javaee", "timezone"), new QName("http://java.sun.com/xml/ns/javaee", "info")); } } if (descriptions != null) { try { timer.setDescriptions(descriptions.toArray(new Text[descriptions.size()])); } catch (final Exception e) { context.setterError(reader, Timer.class, "setDescriptions", Text[].class, e); } } context.afterUnmarshal(timer, LifecycleCallback.NONE); return timer; }