Package org.jboss.resteasy.annotations.providers.jaxb

Examples of org.jboss.resteasy.annotations.providers.jaxb.Wrapped


      {
         StreamSource source = new StreamSource(entityStream);
         JAXBContext ctx = finder.findCachedContext(JaxbCollection.class, mediaType, annotations);
         JAXBElement<JaxbCollection> ele = ctx.createUnmarshaller().unmarshal(source, JaxbCollection.class);

         Wrapped wrapped = FindAnnotation.findAnnotation(annotations, Wrapped.class);
         if (wrapped != null)
         {
            if (!wrapped.element().equals(ele.getName().getLocalPart()))
            {
               throw new JAXBUnmarshalException("Collection wrapping failed, expected root element name of " + wrapped.element() + " got " + ele.getName().getLocalPart());
            }
            if (!wrapped.namespace().equals(ele.getName().getNamespaceURI()))
            {
               throw new JAXBUnmarshalException("Collection wrapping failed, expect namespace of " + wrapped.namespace() + " got " + ele.getName().getNamespaceURI());
            }
         }

         col = ele.getValue();
      }
View Full Code Here


         String element = "collection";
         String namespaceURI = "";
         String prefix = "";

         Wrapped wrapped = FindAnnotation.findAnnotation(annotations, Wrapped.class);
         if (wrapped != null)
         {
            element = wrapped.element();
            namespaceURI = wrapped.namespace();
            prefix = wrapped.prefix();
         }


         JAXBElement<JaxbCollection> collection = new JAXBElement<JaxbCollection>(new QName(namespaceURI, element, prefix), JaxbCollection.class, col);
         Marshaller marshaller = ctx.createMarshaller();
View Full Code Here

      return ann;
   }

   public static Wrapped create(final String elementName, final String namespace, final String prefix)
   {
      return new Wrapped()
      {
         public String element()
         {
            return elementName == null ? "" : elementName;
         }
View Full Code Here

            }
            JAXBContext ctx = finder.findCachedContext(JaxbCollection.class, mediaType, annotations);
            ele = ctx.createUnmarshaller().unmarshal(source, JaxbCollection.class);
         }
        
         Wrapped wrapped = FindAnnotation.findAnnotation(annotations, Wrapped.class);
         if (wrapped != null)
         {
            if (!wrapped.element().equals(ele.getName().getLocalPart()))
            {
               throw new JAXBUnmarshalException("Collection wrapping failed, expected root element name of " + wrapped.element() + " got " + ele.getName().getLocalPart());
            }
            if (!wrapped.namespace().equals(ele.getName().getNamespaceURI()))
            {
               throw new JAXBUnmarshalException("Collection wrapping failed, expect namespace of " + wrapped.namespace() + " got " + ele.getName().getNamespaceURI());
            }
         }

         col = ele.getValue();
      }
View Full Code Here

         String element = "collection";
         String namespaceURI = "";
         String prefix = "";

         Wrapped wrapped = FindAnnotation.findAnnotation(annotations, Wrapped.class);
         if (wrapped != null)
         {
            element = wrapped.element();
            namespaceURI = wrapped.namespace();
            prefix = wrapped.prefix();
         }


         JAXBElement<JaxbCollection> collection = new JAXBElement<JaxbCollection>(new QName(namespaceURI, element, prefix), JaxbCollection.class, col);
         Marshaller marshaller = ctx.createMarshaller();
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.annotations.providers.jaxb.Wrapped

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.