Package com.sun.xml.bind.api

Examples of com.sun.xml.bind.api.TypeReference


                } else if (honorJaxbAnnotation && anns.length > 0) {
                    //RpcLit will use the JAXB Bridge to marshall part message when it is
                    //annotated with @XmlList,@XmlAttachmentRef,@XmlJavaTypeAdapter
                    //TODO:Cache the JAXBRIContext
                    QName qname = new QName(null, part.getConcreteName().getLocalPart());
                    TypeReference typeReference = new TypeReference(qname, part.getTypeClass(), anns);
                    JAXBEncoderDecoder.marshalWithBridge(typeReference, contextClasses, obj,
                                                         output, getAttachmentMarshaller());
                }
            }
        } else if (obj == null && needToRender(obj, part)) {
View Full Code Here


      if (fmd.loadFaultBean() == null)
         wrapperGenerator.generate(fmd);

      javaTypes.add(fmd.getFaultBean());
      typeRefs.add(new TypeReference(fmd.getXmlName(), fmd.getFaultBean()));

      opMetaData.addFault(fmd);
   }
View Full Code Here

            if (anWebParam != null && !opMetaData.isDocumentWrapped() && anWebParam.partName().length() > 0)
               paramMetaData.setPartName(anWebParam.partName());

            opMetaData.addParameter(paramMetaData);
            javaTypes.add(javaType);
            typeRefs.add(new TypeReference(xmlName, genericType, parameterAnnotations[i]));

            processAttachmentAnnotations(scanResult, i, paramMetaData);
            processMIMEBinding(epMetaData, opMetaData, paramMetaData);
         }
      }

      // Build result meta data
      Class<?> returnType = method.getReturnType();
      Type genericReturnType = method.getGenericReturnType();
      String returnTypeName = returnType.getName();
      if (!(returnType == void.class))
      {
         if (opMetaData.isOneWay())
            throw new IllegalArgumentException("[JSR-181 2.5.1] The method '" + method.getName() + "' can not have a return value if it is marked OneWay");

         WebResult anWebResult = method.getAnnotation(WebResult.class);
         boolean isHeader = anWebResult != null && anWebResult.header();
         boolean isWrappedBody = opMetaData.isDocumentWrapped() && !isHeader;
         QName xmlName = getWebResultName(opMetaData, anWebResult);

         if (isWrappedBody)
         {
            WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName, convertToVariable(xmlName.getLocalPart()), -1);
            wrapped.setTypeArguments(convertTypeArguments(returnType, genericReturnType));
            wrapped.setXmlList(method.getAnnotation(XmlList.class) != null);
            XmlJavaTypeAdapter xmlJavaTypeAdapter = method.getAnnotation(XmlJavaTypeAdapter.class);
            if (xmlJavaTypeAdapter != null)
            {
               //XmlJavaTypeAdapter.type() is for package only
               wrapped.setAdapter(xmlJavaTypeAdapter.value().getName());
            }

            // insert at the beginning just for prettiness
            wrappedOutputParameters.add(0, wrapped);

            processAttachmentAnnotationsWrapped(scanResult, -1, wrapped);
         }
         else
         {
            ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, returnTypeName);
            retMetaData.setInHeader(isHeader);
            retMetaData.setIndex(-1);
            retMetaData.setMode(ParameterMode.OUT);

            // Special case: If we have a document/literal wrapped message, then
            // the return metadata must be the wrapper type that is sent in the
            // body. So, in order to handle headers that are mapped to the java
            // return value, we have to add them to a parameter with an index of
            // -1 to signify the return value. All other binding styles use the
            // expected return value mechanism.
            if (opMetaData.isDocumentWrapped())
            {
               opMetaData.addParameter(retMetaData);
            }
            else
            {
               // See above comment in the parameter for loop section as to why
               // we prevent customization of part names on document wrapped
               // header parameters.
               if (anWebResult != null && anWebResult.partName().length() > 0)
                  retMetaData.setPartName(anWebResult.partName());

               opMetaData.setReturnParameter(retMetaData);
            }

            javaTypes.add(returnType);
            typeRefs.add(new TypeReference(xmlName, genericReturnType, method.getAnnotations()));

            processAttachmentAnnotations(scanResult, -1, retMetaData);
            processMIMEBinding(epMetaData, opMetaData, retMetaData);
         }
      }

      // Generate wrapper beans
      if (opMetaData.isDocumentWrapped())
      {
         if (wrapperParameter.loadWrapperBean() == null)
            wrapperGenerator.generate(wrapperParameter);

         Class<?> wrapperClass = wrapperParameter.getJavaType();
         javaTypes.add(wrapperClass);

         // In case there is no @XmlRootElement
         typeRefs.add(new TypeReference(wrapperParameter.getXmlName(), wrapperClass));
         if (!opMetaData.isOneWay())
         {
            if (wrapperOutputParameter.loadWrapperBean() == null)
               wrapperGenerator.generate(wrapperOutputParameter);

            wrapperClass = wrapperOutputParameter.getJavaType();
            javaTypes.add(wrapperClass);

            // In case there is no @XmlRootElement
            typeRefs.add(new TypeReference(wrapperOutputParameter.getXmlName(), wrapperClass));
         }
      }

      // Add faults
      for (Class<?> exClass : method.getExceptionTypes())
View Full Code Here

      if (xmlType == null)
      {
         try
         {
            xmlType = jaxbCtx.getTypeName(new TypeReference(xmlName, javaType));
         }
         catch (IllegalArgumentException e)
         {
            throw new IllegalStateException("Cannot obtain xml type for: [xmlName=" + xmlName + ",javaName=" + javaName + "]");
         }
View Full Code Here

      if (fmd.loadFaultBean() == null)
         wrapperGenerator.generate(fmd);

      javaTypes.add(fmd.getFaultBean());
      typeRefs.add(new TypeReference(fmd.getXmlName(), fmd.getFaultBean()));

      opMetaData.addFault(fmd);
   }
View Full Code Here

            if (anWebParam != null && !opMetaData.isDocumentWrapped() && anWebParam.partName().length() > 0)
               paramMetaData.setPartName(anWebParam.partName());

            opMetaData.addParameter(paramMetaData);
            javaTypes.add(javaType);
            typeRefs.add(new TypeReference(xmlName, genericType, parameterAnnotations[i]));

            processAttachmentAnnotations(scanResult, i, paramMetaData);
            processMIMEBinding(epMetaData, opMetaData, paramMetaData);
         }
      }

      // Build result meta data
      Class<?> returnType = method.getReturnType();
      Type genericReturnType = method.getGenericReturnType();
      String returnTypeName = returnType.getName();
      if (!(returnType == void.class))
      {
         if (opMetaData.isOneWay())
            throw new IllegalArgumentException("[JSR-181 2.5.1] The method '" + method.getName() + "' can not have a return value if it is marked OneWay");

         WebResult anWebResult = method.getAnnotation(WebResult.class);
         boolean isHeader = anWebResult != null && anWebResult.header();
         boolean isWrappedBody = opMetaData.isDocumentWrapped() && !isHeader;
         QName xmlName = getWebResultName(opMetaData, anWebResult);

         if (isWrappedBody)
         {
            WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName, convertToVariable(xmlName.getLocalPart()), -1);
            wrapped.setTypeArguments(convertTypeArguments(returnType, genericReturnType));
            wrapped.setXmlList(method.getAnnotation(XmlList.class) != null);
            XmlJavaTypeAdapter xmlJavaTypeAdapter = method.getAnnotation(XmlJavaTypeAdapter.class);
            if (xmlJavaTypeAdapter != null)
            {
               //XmlJavaTypeAdapter.type() is for package only
               wrapped.setAdapter(xmlJavaTypeAdapter.value().getName());
            }

            // insert at the beginning just for prettiness
            wrappedOutputParameters.add(0, wrapped);

            processAttachmentAnnotationsWrapped(scanResult, -1, wrapped);
         }
         else
         {
            ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, returnTypeName);
            retMetaData.setInHeader(isHeader);
            retMetaData.setIndex(-1);
            retMetaData.setMode(ParameterMode.OUT);

            // Special case: If we have a document/literal wrapped message, then
            // the return metadata must be the wrapper type that is sent in the
            // body. So, in order to handle headers that are mapped to the java
            // return value, we have to add them to a parameter with an index of
            // -1 to signify the return value. All other binding styles use the
            // expected return value mechanism.
            if (opMetaData.isDocumentWrapped())
            {
               opMetaData.addParameter(retMetaData);
            }
            else
            {
               // See above comment in the parameter for loop section as to why
               // we prevent customization of part names on document wrapped
               // header parameters.
               if (anWebResult != null && anWebResult.partName().length() > 0)
                  retMetaData.setPartName(anWebResult.partName());

               opMetaData.setReturnParameter(retMetaData);
            }

            javaTypes.add(returnType);
            typeRefs.add(new TypeReference(xmlName, genericReturnType, method.getAnnotations()));

            processAttachmentAnnotations(scanResult, -1, retMetaData);
            processMIMEBinding(epMetaData, opMetaData, retMetaData);
         }
      }

      // Generate wrapper beans
      if (opMetaData.isDocumentWrapped())
      {
         if (wrapperParameter.loadWrapperBean() == null)
            wrapperGenerator.generate(wrapperParameter);

         Class<?> wrapperClass = wrapperParameter.getJavaType();
         javaTypes.add(wrapperClass);

         // In case there is no @XmlRootElement
         typeRefs.add(new TypeReference(wrapperParameter.getXmlName(), wrapperClass));
         if (!opMetaData.isOneWay())
         {
            if (wrapperOutputParameter.loadWrapperBean() == null)
               wrapperGenerator.generate(wrapperOutputParameter);

            wrapperClass = wrapperOutputParameter.getJavaType();
            javaTypes.add(wrapperClass);

            // In case there is no @XmlRootElement
            typeRefs.add(new TypeReference(wrapperOutputParameter.getXmlName(), wrapperClass));
         }
      }

      // Add faults
      for (Class<?> exClass : method.getExceptionTypes())
View Full Code Here

      if (xmlType == null)
      {
         try
         {
            xmlType = jaxbCtx.getTypeName(new TypeReference(xmlName, javaType));
         }
         catch (IllegalArgumentException e)
         {
            throw new IllegalStateException("Cannot obtain xml type for: [xmlName=" + xmlName + ",javaName=" + javaName + "]");
         }
View Full Code Here

      if (fmd.loadFaultBean() == null)
         wrapperGenerator.generate(fmd);

      javaTypes.add(fmd.getFaultBean());
      typeRefs.add(new TypeReference(fmd.getXmlName(), fmd.getFaultBean()));

      opMetaData.addFault(fmd);
   }
View Full Code Here

            if (anWebParam != null && !opMetaData.isDocumentWrapped() && anWebParam.partName().length() > 0)
               paramMetaData.setPartName(anWebParam.partName());

            opMetaData.addParameter(paramMetaData);
            javaTypes.add(javaType);
            typeRefs.add(new TypeReference(xmlName, genericType, parameterAnnotations[i]));

            processAttachmentAnnotations(scanResult, i, paramMetaData);
            processMIMEBinding(epMetaData, opMetaData, paramMetaData);
         }
      }

      // Build result meta data
      Class<?> returnType = method.getReturnType();
      Type genericReturnType = method.getGenericReturnType();
      String returnTypeName = returnType.getName();
      if (!(returnType == void.class))
      {
         if (opMetaData.isOneWay())
            throw new IllegalArgumentException("[JSR-181 2.5.1] The method '" + method.getName() + "' can not have a return value if it is marked OneWay");

         WebResult anWebResult = method.getAnnotation(WebResult.class);
         boolean isHeader = anWebResult != null && anWebResult.header();
         boolean isWrappedBody = opMetaData.isDocumentWrapped() && !isHeader;
         QName xmlName = getWebResultName(opMetaData, anWebResult);

         if (isWrappedBody)
         {
            WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName, convertToVariable(xmlName.getLocalPart()), -1);
            wrapped.setTypeArguments(convertTypeArguments(returnType, genericReturnType));

            // insert at the beginning just for prettiness
            wrappedOutputParameters.add(0, wrapped);

            processAttachmentAnnotationsWrapped(scanResult, -1, wrapped);
         }
         else
         {
            ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, returnTypeName);
            retMetaData.setInHeader(isHeader);
            retMetaData.setIndex(-1);
            retMetaData.setMode(ParameterMode.OUT);

            // Special case: If we have a document/literal wrapped message, then
            // the return metadata must be the wrapper type that is sent in the
            // body. So, in order to handle headers that are mapped to the java
            // return value, we have to add them to a parameter with an index of
            // -1 to signify the return value. All other binding styles use the
            // expected return value mechanism.
            if (opMetaData.isDocumentWrapped())
            {
               opMetaData.addParameter(retMetaData);
            }
            else
            {
               // See above comment in the parameter for loop section as to why
               // we prevent customization of part names on document wrapped
               // header parameters.
               if (anWebResult != null && anWebResult.partName().length() > 0)
                  retMetaData.setPartName(anWebResult.partName());

               opMetaData.setReturnParameter(retMetaData);
            }

            javaTypes.add(returnType);
            typeRefs.add(new TypeReference(xmlName, genericReturnType, method.getAnnotations()));

            processAttachmentAnnotations(scanResult, -1, retMetaData);
            processMIMEBinding(epMetaData, opMetaData, retMetaData);
         }
      }

      // Generate wrapper beans
      if (opMetaData.isDocumentWrapped())
      {
         if (wrapperParameter.loadWrapperBean() == null)
            wrapperGenerator.generate(wrapperParameter);

         Class<?> wrapperClass = wrapperParameter.getJavaType();
         javaTypes.add(wrapperClass);

         // In case there is no @XmlRootElement
         typeRefs.add(new TypeReference(wrapperParameter.getXmlName(), wrapperClass));
         if (!opMetaData.isOneWay())
         {
            if (wrapperOutputParameter.loadWrapperBean() == null)
               wrapperGenerator.generate(wrapperOutputParameter);

            wrapperClass = wrapperOutputParameter.getJavaType();
            javaTypes.add(wrapperClass);

            // In case there is no @XmlRootElement
            typeRefs.add(new TypeReference(wrapperOutputParameter.getXmlName(), wrapperClass));
         }
      }

      // Add faults
      for (Class<?> exClass : method.getExceptionTypes())
View Full Code Here

      if (xmlType == null)
      {
         try
         {
            xmlType = jaxbCtx.getTypeName(new TypeReference(xmlName, javaType));
         }
         catch (IllegalArgumentException e)
         {
            throw new IllegalStateException("Cannot obtain xml type for: [xmlName=" + xmlName + ",javaName=" + javaName + "]");
         }
View Full Code Here

TOP

Related Classes of com.sun.xml.bind.api.TypeReference

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.