Java Code Examples for javax.xml.bind.annotation.adapters.CollapsedStringAdapter

The following examples show how to use javax.xml.bind.annotation.adapters.CollapsedStringAdapter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:SAML:1.0:assertion",
   name = "AssertionIDReference"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAssertionIDReference(String value) {
   return new JAXBElement(_AssertionIDReference_QNAME, String.class, (Class)null, value);
}
 
Example 2
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:dss:1.0:core:schema",
   name = "Language"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLanguage(String value) {
   return new JAXBElement(_Language_QNAME, String.class, (Class)null, value);
}
 
Example 3
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:SAML:1.0:assertion",
   name = "AssertionIDReference"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAssertionIDReference(String value) {
   return new JAXBElement(_AssertionIDReference_QNAME, String.class, (Class)null, value);
}
 
Example 4
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:dss:1.0:core:schema",
   name = "Language"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLanguage(String value) {
   return new JAXBElement(_Language_QNAME, String.class, (Class)null, value);
}
 
Example 5
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:SAML:1.0:assertion",
   name = "AssertionIDReference"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAssertionIDReference(String value) {
   return new JAXBElement(_AssertionIDReference_QNAME, String.class, (Class)null, value);
}
 
Example 6
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:dss:1.0:core:schema",
   name = "Language"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLanguage(String value) {
   return new JAXBElement(_Language_QNAME, String.class, (Class)null, value);
}
 
Example 7
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:SAML:1.0:assertion",
   name = "AssertionIDReference"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAssertionIDReference(String value) {
   return new JAXBElement(_AssertionIDReference_QNAME, String.class, (Class)null, value);
}
 
Example 8
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:dss:1.0:core:schema",
   name = "Language"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLanguage(String value) {
   return new JAXBElement(_Language_QNAME, String.class, (Class)null, value);
}
 
Example 9
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:SAML:2.0:assertion",
   name = "AssertionIDRef"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAssertionIDRef(String value) {
   return new JAXBElement(_AssertionIDRef_QNAME, String.class, (Class)null, value);
}
 
Example 10
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:SAML:1.0:assertion",
   name = "AssertionIDReference"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAssertionIDReference(String value) {
   return new JAXBElement(_AssertionIDReference_QNAME, String.class, (Class)null, value);
}
 
Example 11
@XmlElementDecl(
   namespace = "urn:oasis:names:tc:dss:1.0:core:schema",
   name = "Language"
)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLanguage(String value) {
   return new JAXBElement(_Language_QNAME, String.class, (Class)null, value);
}
 
Example 12
Source Project: development   Source File: ObjectFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 * 
 */
@XmlElementDecl(namespace = "urn:oasis:names:tc:SAML:2.0:assertion", name = "AssertionIDRef")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAssertionIDRef(String value) {
    return new JAXBElement<String>(_AssertionIDRef_QNAME, String.class,
            null, value);
}
 
Example 13
Source Project: sis   Source File: DefaultRepresentativeFraction.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Invoked by JAXB for fetching the unique identifier unique for the XML document.
 *
 * @see org.apache.sis.metadata.iso.ISOMetadata#getID()
 */
@XmlID
@XmlAttribute  // Defined in "gco" as unqualified attribute.
@XmlSchemaType(name = "ID")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
private String getID() {
    return isNullOrEmpty(identifiers) ? null : MetadataUtilities.getObjectID(this);
}
 
Example 14
Source Project: sis   Source File: ISOMetadata.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns an identifier unique for the XML document, or {@code null} if none.
 * This method is invoked automatically by JAXB and should never be invoked explicitly.
 */
@XmlID
@XmlAttribute                           // Defined in "gco" as unqualified attribute.
@XmlSchemaType(name = "ID")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
private String getID() {
    return isNullOrEmpty(identifiers) ? null : MetadataUtilities.getObjectID(this);
}
 
Example 15
Source Project: sis   Source File: ISOMetadata.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns an unique identifier, or {@code null} if none.
 * This method is invoked automatically by JAXB and should never be invoked explicitly.
 */
@XmlAttribute                           // Defined in "gco" as unqualified attribute.
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
private String getUUID() {
    /*
     * IdentifierMapAdapter will take care of converting UUID to String,
     * or to return a previously stored String if it was an unparsable UUID.
     */
    return isNullOrEmpty(identifiers) ? null : getIdentifierMap().get(IdentifierSpace.UUID);
}
 
Example 16
Source Project: tomee   Source File: SessionBean$JAXB.java    License: Apache License 2.0 5 votes vote down vote up
public final static void _readDependsOn(final XoXMLStreamReader reader, final RuntimeContext context, final SessionBean sessionBean)
    throws Exception {
    List<String> dependsOn = null;

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: dependsOn
            final String dependsOnItemRaw = elementReader.getElementAsString();

            final String dependsOnItem;
            try {
                dependsOnItem = Adapters.collapsedStringAdapterAdapter.unmarshal(dependsOnItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            if (dependsOn == null) {
                dependsOn = sessionBean.dependsOn;
                if (dependsOn != null) {
                    dependsOn.clear();
                } else {
                    dependsOn = new ArrayList<String>();
                }
            }
            dependsOn.add(dependsOnItem);
        }
    }
    if (dependsOn != null) {
        sessionBean.dependsOn = dependsOn;
    }
}
 
Example 17
Source Project: nomulus   Source File: ContactInfoData.java    License: Apache License 2.0 4 votes vote down vote up
@XmlElement(name = "email")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@Nullable
abstract String getEmailAddress();
 
Example 18
Source Project: bamboobsc   Source File: ObjectFactory.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createId(String value) {
    return new JAXBElement<String>(_Id_QNAME, String.class, null, value);
}
 
Example 19
@XmlValue
@XmlJavaTypeAdapter(value = CollapsedStringAdapter.class)
public String getInterfaceName() {
	return interfaceName;
}
 
Example 20
Source Project: jaxb2-basics   Source File: ExtendsClass.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
@XmlValue
@XmlJavaTypeAdapter(value = CollapsedStringAdapter.class)
String getClassName() {
	return className;
}
 
Example 21
Source Project: sis   Source File: DefaultRepresentativeFraction.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Invoked by JAXB for fetching the unique identifier unique "worldwide".
 *
 * @see org.apache.sis.metadata.iso.ISOMetadata#getUUID()
 */
@XmlAttribute  // Defined in "gco" as unqualified attribute.
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
private String getUUID() {
    return isNullOrEmpty(identifiers) ? null : getIdentifierMap().get(IdentifierSpace.UUID);
}
 
Example 22
Source Project: tomee   Source File: MessageListener$JAXB.java    License: Apache License 2.0 4 votes vote down vote up
public final static MessageListener _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final MessageListener messageListener = new MessageListener();
    context.beforeUnmarshal(messageListener, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("messagelistenerType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, MessageListener.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, messageListener);
            messageListener.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 (("messagelistener-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: messageListenerType
            final String messageListenerTypeRaw = elementReader.getElementAsString();

            final String messageListenerType;
            try {
                messageListenerType = Adapters.collapsedStringAdapterAdapter.unmarshal(messageListenerTypeRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            messageListener.messageListenerType = messageListenerType;
        } else if (("activationspec" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: activationSpec
            final ActivationSpec activationSpec = readActivationSpec(elementReader, context);
            messageListener.activationSpec = activationSpec;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "messagelistener-type"), new QName("http://java.sun.com/xml/ns/javaee", "activationspec"));
        }
    }

    context.afterUnmarshal(messageListener, LifecycleCallback.NONE);

    return messageListener;
}
 
Example 23
Source Project: tomee   Source File: MethodParams$JAXB.java    License: Apache License 2.0 4 votes vote down vote up
public final static MethodParams _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final MethodParams methodParams = new MethodParams();
    context.beforeUnmarshal(methodParams, LifecycleCallback.NONE);

    List<String> methodParam = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("method-paramsType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, MethodParams.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, methodParams);
            methodParams.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 (("method-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: methodParam
            final String methodParamItemRaw = elementReader.getElementAsString();

            final String methodParamItem;
            try {
                methodParamItem = Adapters.collapsedStringAdapterAdapter.unmarshal(methodParamItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            if (methodParam == null) {
                methodParam = methodParams.methodParam;
                if (methodParam != null) {
                    methodParam.clear();
                } else {
                    methodParam = new ArrayList<String>();
                }
            }
            methodParam.add(methodParamItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "method-param"));
        }
    }
    if (methodParam != null) {
        methodParams.methodParam = methodParam;
    }

    context.afterUnmarshal(methodParams, LifecycleCallback.NONE);

    return methodParams;
}
 
Example 24
Source Project: tomee   Source File: InterceptorOrder$JAXB.java    License: Apache License 2.0 4 votes vote down vote up
public final static InterceptorOrder _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final InterceptorOrder interceptorOrder = new InterceptorOrder();
    context.beforeUnmarshal(interceptorOrder, LifecycleCallback.NONE);

    List<String> interceptorClass = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("interceptor-orderType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, InterceptorOrder.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, interceptorOrder);
            interceptorOrder.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 (("interceptor-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: interceptorClass
            final String interceptorClassItemRaw = elementReader.getElementAsString();

            final String interceptorClassItem;
            try {
                interceptorClassItem = Adapters.collapsedStringAdapterAdapter.unmarshal(interceptorClassItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            if (interceptorClass == null) {
                interceptorClass = interceptorOrder.interceptorClass;
                if (interceptorClass != null) {
                    interceptorClass.clear();
                } else {
                    interceptorClass = new ArrayList<String>();
                }
            }
            interceptorClass.add(interceptorClassItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "interceptor-class"));
        }
    }
    if (interceptorClass != null) {
        interceptorOrder.interceptorClass = interceptorClass;
    }

    context.afterUnmarshal(interceptorOrder, LifecycleCallback.NONE);

    return interceptorOrder;
}
 
Example 25
Source Project: tomee   Source File: FacesLocale$JAXB.java    License: Apache License 2.0 4 votes vote down vote up
public final static FacesLocale _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final FacesLocale facesLocale = new FacesLocale();
    context.beforeUnmarshal(facesLocale, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-localeType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesLocale.class);
        }
    }

    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute);
        }
    }

    // VALUE: value
    final String valueRaw = reader.getElementText();

    String value = null;
    boolean valueConverted;
    try {
        value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw);
        valueConverted = true;
    } catch (final Exception e) {
        context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e);
        valueConverted = false;
    }

    if (valueConverted) {
        facesLocale.value = value;
    }

    context.afterUnmarshal(facesLocale, LifecycleCallback.NONE);

    return facesLocale;
}
 
Example 26
Source Project: tomee   Source File: SecurityConstraint$JAXB.java    License: Apache License 2.0 4 votes vote down vote up
public final static SecurityConstraint _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final SecurityConstraint securityConstraint = new SecurityConstraint();
    context.beforeUnmarshal(securityConstraint, LifecycleCallback.NONE);

    List<String> displayName = null;
    List<WebResourceCollection> webResourceCollection = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("security-constraintType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, SecurityConstraint.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, securityConstraint);
            securityConstraint.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 (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: displayName
            final String displayNameItemRaw = elementReader.getElementAsString();

            final String displayNameItem;
            try {
                displayNameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(displayNameItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            if (displayName == null) {
                displayName = securityConstraint.displayName;
                if (displayName != null) {
                    displayName.clear();
                } else {
                    displayName = new ArrayList<String>();
                }
            }
            displayName.add(displayNameItem);
        } else if (("web-resource-collection" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: webResourceCollection
            final WebResourceCollection webResourceCollectionItem = readWebResourceCollection(elementReader, context);
            if (webResourceCollection == null) {
                webResourceCollection = securityConstraint.webResourceCollection;
                if (webResourceCollection != null) {
                    webResourceCollection.clear();
                } else {
                    webResourceCollection = new ArrayList<WebResourceCollection>();
                }
            }
            webResourceCollection.add(webResourceCollectionItem);
        } else if (("auth-constraint" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: authConstraint
            final AuthConstraint authConstraint = readAuthConstraint(elementReader, context);
            securityConstraint.authConstraint = authConstraint;
        } else if (("user-data-constraint" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: userDataConstraint
            final UserDataConstraint userDataConstraint = readUserDataConstraint(elementReader, context);
            securityConstraint.userDataConstraint = userDataConstraint;
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "display-name"), new QName("http://java.sun.com/xml/ns/javaee", "web-resource-collection"), new QName("http://java.sun.com/xml/ns/javaee", "auth-constraint"), new QName("http://java.sun.com/xml/ns/javaee", "user-data-constraint"));
        }
    }
    if (displayName != null) {
        securityConstraint.displayName = displayName;
    }
    if (webResourceCollection != null) {
        securityConstraint.webResourceCollection = webResourceCollection;
    }

    context.afterUnmarshal(securityConstraint, LifecycleCallback.NONE);

    return securityConstraint;
}
 
Example 27
Source Project: tomee   Source File: SubscriptionDurability$JAXB.java    License: Apache License 2.0 4 votes vote down vote up
public final static SubscriptionDurability _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final SubscriptionDurability subscriptionDurability = new SubscriptionDurability();
    context.beforeUnmarshal(subscriptionDurability, LifecycleCallback.NONE);


    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        return context.unexpectedXsiType(reader, SubscriptionDurability.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, subscriptionDurability);
            subscriptionDurability.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }

    // VALUE: value
    final String valueRaw = reader.getElementText();

    String value = null;
    boolean valueConverted;
    try {
        value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw);
        valueConverted = true;
    } catch (final Exception e) {
        context.xmlAdapterError(reader, CollapsedStringAdapter.class, String.class, String.class, e);
        valueConverted = false;
    }

    if (valueConverted) {
        subscriptionDurability.value = value;
    }

    context.afterUnmarshal(subscriptionDurability, LifecycleCallback.NONE);

    return subscriptionDurability;
}
 
Example 28
Source Project: tomee   Source File: TldExtension$JAXB.java    License: Apache License 2.0 4 votes vote down vote up
public final static TldExtension _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final TldExtension tldExtension = new TldExtension();
    context.beforeUnmarshal(tldExtension, LifecycleCallback.NONE);

    List<String> extensionElement = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("tld-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, TldExtension.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, tldExtension);
            tldExtension.id = id;
        } else if (("namespace" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: namespace
            tldExtension.namespace = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "namespace"));
        }
    }

    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("extension-element" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: extensionElement
            final String extensionElementItemRaw = elementReader.getElementAsString();

            final String extensionElementItem;
            try {
                extensionElementItem = Adapters.collapsedStringAdapterAdapter.unmarshal(extensionElementItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            if (extensionElement == null) {
                extensionElement = tldExtension.extensionElement;
                if (extensionElement != null) {
                    extensionElement.clear();
                } else {
                    extensionElement = new ArrayList<String>();
                }
            }
            extensionElement.add(extensionElementItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "extension-element"));
        }
    }
    if (extensionElement != null) {
        tldExtension.extensionElement = extensionElement;
    }

    context.afterUnmarshal(tldExtension, LifecycleCallback.NONE);

    return tldExtension;
}
 
Example 29
public final static ServiceEndpointInterfaceMapping _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping = new ServiceEndpointInterfaceMapping();
    context.beforeUnmarshal(serviceEndpointInterfaceMapping, LifecycleCallback.NONE);

    List<ServiceEndpointMethodMapping> serviceEndpointMethodMapping = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("service-endpoint-interface-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, ServiceEndpointInterfaceMapping.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, serviceEndpointInterfaceMapping);
            serviceEndpointInterfaceMapping.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 (("service-endpoint-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: serviceEndpointInterface
            final String serviceEndpointInterfaceRaw = elementReader.getElementAsString();

            final String serviceEndpointInterface;
            try {
                serviceEndpointInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointInterfaceRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            serviceEndpointInterfaceMapping.serviceEndpointInterface = serviceEndpointInterface;
        } else if (("wsdl-port-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: wsdlPortType
            final QName wsdlPortType = elementReader.getElementAsQName();
            serviceEndpointInterfaceMapping.wsdlPortType = wsdlPortType;
        } else if (("wsdl-binding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: wsdlBinding
            final QName wsdlBinding = elementReader.getElementAsQName();
            serviceEndpointInterfaceMapping.wsdlBinding = wsdlBinding;
        } else if (("service-endpoint-method-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: serviceEndpointMethodMapping
            final ServiceEndpointMethodMapping serviceEndpointMethodMappingItem = readServiceEndpointMethodMapping(elementReader, context);
            if (serviceEndpointMethodMapping == null) {
                serviceEndpointMethodMapping = serviceEndpointInterfaceMapping.serviceEndpointMethodMapping;
                if (serviceEndpointMethodMapping != null) {
                    serviceEndpointMethodMapping.clear();
                } else {
                    serviceEndpointMethodMapping = new ArrayList<ServiceEndpointMethodMapping>();
                }
            }
            serviceEndpointMethodMapping.add(serviceEndpointMethodMappingItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint-interface"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-port-type"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-binding"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint-method-mapping"));
        }
    }
    if (serviceEndpointMethodMapping != null) {
        serviceEndpointInterfaceMapping.serviceEndpointMethodMapping = serviceEndpointMethodMapping;
    }

    context.afterUnmarshal(serviceEndpointInterfaceMapping, LifecycleCallback.NONE);

    return serviceEndpointInterfaceMapping;
}
 
Example 30
Source Project: tomee   Source File: FacesOrderingOrdering$JAXB.java    License: Apache License 2.0 4 votes vote down vote up
public final static FacesOrderingOrdering _read(final XoXMLStreamReader reader, RuntimeContext context)
    throws Exception {

    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }

    if (context == null) {
        context = new RuntimeContext();
    }

    final FacesOrderingOrdering facesOrderingOrdering = new FacesOrderingOrdering();
    context.beforeUnmarshal(facesOrderingOrdering, LifecycleCallback.NONE);

    List<String> name = null;

    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-ordering-orderingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesOrderingOrdering.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: name
            String nameItemRaw = null;
            if (!elementReader.isXsiNil()) {
                nameItemRaw = elementReader.getElementAsString();
            }

            final String nameItem;
            try {
                nameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(nameItemRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }

            if (name == null) {
                name = facesOrderingOrdering.name;
                if (name != null) {
                    name.clear();
                } else {
                    name = new ArrayList<String>();
                }
            }
            name.add(nameItem);
        } else if (("others" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: others
            final FacesOrderingOthers others = readFacesOrderingOthers(elementReader, context);
            facesOrderingOrdering.others = others;
        } 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 (name != null) {
        facesOrderingOrdering.name = name;
    }

    context.afterUnmarshal(facesOrderingOrdering, LifecycleCallback.NONE);

    return facesOrderingOrdering;
}