Package com.sun.xml.bind.api

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


/*      */
/*  314 */     if (fmd.loadFaultBean() == null) {
/*  315 */       this.wrapperGenerator.generate(fmd);
/*      */     }
/*  317 */     this.javaTypes.add(fmd.getFaultBean());
/*  318 */     this.typeRefs.add(new TypeReference(fmd.getXmlName(), fmd.getFaultBean(), new Annotation[0]));
/*      */
/*  320 */     opMetaData.addFault(fmd);
/*      */   }
View Full Code Here


/*  684 */         if ((anWebParam != null) && (!opMetaData.isDocumentWrapped()) && (anWebParam.partName().length() > 0)) {
/*  685 */           paramMetaData.setPartName(anWebParam.partName());
/*      */         }
/*  687 */         opMetaData.addParameter(paramMetaData);
/*  688 */         this.javaTypes.add(javaType);
/*  689 */         this.typeRefs.add(new TypeReference(xmlName, genericType, parameterAnnotations[i]));
/*      */
/*  691 */         processAttachmentAnnotations(scanResult, i, paramMetaData);
/*  692 */         processMIMEBinding(epMetaData, opMetaData, paramMetaData);
/*      */       }
/*      */
/*      */     }
/*      */
/*  697 */     Class returnType = method.getReturnType();
/*  698 */     Type genericReturnType = method.getGenericReturnType();
/*  699 */     String returnTypeName = returnType.getName();
/*  700 */     if (returnType != Void.TYPE)
/*      */     {
/*  702 */       if (opMetaData.isOneWay()) {
/*  703 */         throw new IllegalArgumentException("[JSR-181 2.5.1] The method '" + method.getName() + "' can not have a return value if it is marked OneWay");
/*      */       }
/*  705 */       WebResult anWebResult = (WebResult)method.getAnnotation(WebResult.class);
/*  706 */       boolean isHeader = (anWebResult != null) && (anWebResult.header());
/*  707 */       boolean isWrappedBody = (opMetaData.isDocumentWrapped()) && (!isHeader);
/*  708 */       QName xmlName = getWebResultName(opMetaData, anWebResult);
/*      */
/*  710 */       if (isWrappedBody)
/*      */       {
/*  712 */         WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName, convertToVariable(xmlName.getLocalPart()), -1);
/*  713 */         wrapped.setTypeArguments(convertTypeArguments(returnType, genericReturnType));
/*      */
/*  716 */         wrappedOutputParameters.add(0, wrapped);
/*      */
/*  718 */         processAttachmentAnnotationsWrapped(scanResult, -1, wrapped);
/*      */       }
/*      */       else
/*      */       {
/*  722 */         ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, returnTypeName);
/*  723 */         retMetaData.setInHeader(isHeader);
/*  724 */         retMetaData.setIndex(-1);
/*  725 */         retMetaData.setMode(ParameterMode.OUT);
/*      */
/*  733 */         if (opMetaData.isDocumentWrapped())
/*      */         {
/*  735 */           opMetaData.addParameter(retMetaData);
/*      */         }
/*      */         else
/*      */         {
/*  742 */           if ((anWebResult != null) && (anWebResult.partName().length() > 0)) {
/*  743 */             retMetaData.setPartName(anWebResult.partName());
/*      */           }
/*  745 */           opMetaData.setReturnParameter(retMetaData);
/*      */         }
/*      */
/*  748 */         this.javaTypes.add(returnType);
/*  749 */         this.typeRefs.add(new TypeReference(xmlName, genericReturnType, method.getAnnotations()));
/*      */
/*  751 */         processAttachmentAnnotations(scanResult, -1, retMetaData);
/*  752 */         processMIMEBinding(epMetaData, opMetaData, retMetaData);
/*      */       }
/*      */
/*      */     }
/*      */
/*  757 */     if (opMetaData.isDocumentWrapped())
/*      */     {
/*  759 */       if (wrapperParameter.loadWrapperBean() == null) {
/*  760 */         this.wrapperGenerator.generate(wrapperParameter);
/*      */       }
/*  762 */       Class wrapperClass = wrapperParameter.getJavaType();
/*  763 */       this.javaTypes.add(wrapperClass);
/*      */
/*  766 */       this.typeRefs.add(new TypeReference(wrapperParameter.getXmlName(), wrapperClass, new Annotation[0]));
/*  767 */       if (!opMetaData.isOneWay())
/*      */       {
/*  769 */         if (wrapperOutputParameter.loadWrapperBean() == null) {
/*  770 */           this.wrapperGenerator.generate(wrapperOutputParameter);
/*      */         }
/*  772 */         wrapperClass = wrapperOutputParameter.getJavaType();
/*  773 */         this.javaTypes.add(wrapperClass);
/*      */
/*  776 */         this.typeRefs.add(new TypeReference(wrapperOutputParameter.getXmlName(), wrapperClass, new Annotation[0]));
/*      */       }
/*      */
/*      */     }
/*      */
/*  781 */     for (Class exClass : method.getExceptionTypes()) {
View Full Code Here

/*      */
/*  969 */     if (xmlType == null)
/*      */     {
/*      */       try
/*      */       {
/*  973 */         xmlType = this.jaxbCtx.getTypeName(new TypeReference(xmlName, javaType, new Annotation[0]));
/*      */       }
/*      */       catch (IllegalArgumentException e)
/*      */       {
/*  977 */         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

    private Map<TypeInfo, TypeReference> typeInfoMappings(Collection<TypeInfo> typeInfos) {
        Map<TypeInfo, TypeReference> map = new java.util.HashMap<TypeInfo, TypeReference>();
        for (TypeInfo ti : typeInfos) {
            Type type = WrapperComposite.class.equals(ti.type) ? CompositeStructure.class : ti.type;
            TypeReference tr = new TypeReference(ti.tagName, type, ti.annotations);
            map.put(ti, tr);
        }
        return map;
    }
View Full Code Here

        return JAXBRIContextWrapper.class.getName() + " : " + context.toString();
    }

    @Override
    public XMLBridge createBridge(TypeInfo ti) {
        TypeReference tr = typeRefs.get(ti);
        com.sun.xml.bind.api.Bridge b = context.createBridge(tr);
        return WrapperComposite.class.equals(ti.type)
                ? new WrapperBridge(this, b)
                : new BridgeWrapper(this, b);
    }
View Full Code Here

        return context;
    }

    @Override
    public QName getTypeName(TypeInfo ti) {
        TypeReference tr = typeRefs.get(ti);
        return context.getTypeName(tr);
    }
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.