Package org.jboss.ws.metadata.umdm

Examples of org.jboss.ws.metadata.umdm.WrappedParameter


/*  640 */       if (isWrapped)
/*      */       {
/*  642 */         QName wrappedElementName = getWebParamName(opMetaData, i, anWebParam);
/*  643 */         String variable = convertToVariable(wrappedElementName.getLocalPart());
/*      */
/*  645 */         WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName, javaTypeName, variable, i);
/*  646 */         wrappedParameter.setTypeArguments(convertTypeArguments(javaType, genericType));
/*      */
/*  648 */         if (mode != ParameterMode.OUT) {
/*  649 */           wrappedParameters.add(wrappedParameter);
/*      */         }
/*  651 */         if (mode != ParameterMode.IN)
/*      */         {
/*  653 */           wrappedParameter.setHolder(true);
/*      */
/*  656 */           if (mode == ParameterMode.INOUT)
/*  657 */             wrappedParameter = new WrappedParameter(wrappedParameter);
/*  658 */           wrappedOutputParameters.add(wrappedParameter);
/*      */         }
/*      */
/*  661 */         processAttachmentAnnotationsWrapped(scanResult, i, wrappedParameter);
/*      */       }
/*      */       else
/*      */       {
/*  665 */         QName xmlName = getWebParamName(opMetaData, i, anWebParam);
/*      */
/*  667 */         ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName, javaTypeName);
/*  668 */         paramMetaData.setInHeader(isHeader);
/*  669 */         paramMetaData.setIndex(i);
/*  670 */         paramMetaData.setMode(mode);
/*      */
/*  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);
/*      */       }
View Full Code Here


/* 181 */           throw new WSException("Param Type " + paramType.getName() + " should not extend java.rmi.Remote");
/*     */         }
/* 183 */         if ((om.isDocumentWrapped()) && (!isHeaderParameter(opc, i)))
/*     */         {
/* 185 */           QName xmlName = getXmlName(paramType, opc, i, null);
/* 186 */           wrappedParameters.add(new WrappedParameter(xmlName, paramType.getName(), convertToProperty(xmlName.getLocalPart()), i));
/*     */         }
/*     */         else
/*     */         {
/* 190 */           om.addParameter(getParameterMetaData(paramType, om, opc, i));
/*     */         }
/*     */
/*     */       }
/*     */
/* 195 */       Class returnType = m.getReturnType();
/* 196 */       if (Void.TYPE != returnType)
/*     */       {
/* 198 */         if (Remote.class.isAssignableFrom(returnType)) {
/* 199 */           throw new WSException("Return Type " + returnType.getName() + " should not extend java.rmi.Remote");
/*     */         }
/* 201 */         if (om.isDocumentWrapped())
/*     */         {
/* 203 */           QName name = getReturnXmlName(opc, null);
/*     */
/* 205 */           WrappedParameter wrapped = new WrappedParameter(name, returnType.getName(), convertToProperty(name.getLocalPart()), -1);
/* 206 */           ParameterMetaData retMetaData = om.getReturnParameter();
/* 207 */           retMetaData.getWrappedParameters().add(wrapped);
/*     */         }
/*     */         else
/*     */         {
View Full Code Here

/*     */       {
/*     */         String type;
/*     */         String name;
/* 232 */         if (isWrapped)
/*     */         {
/* 234 */           WrappedParameter wrappedParameter = (WrappedParameter)returnParam.getWrappedParameters().get(0);
/* 235 */           String name = wrappedParameter.getName().getLocalPart();
/* 236 */           type = wrappedParameter.getType();
/*     */         }
/*     */         else
/*     */         {
/* 240 */           name = returnParam.getXmlName().getLocalPart();
/* 241 */           type = returnParam.getJavaTypeName();
View Full Code Here

         if (isWrapped)
         {
            QName wrappedElementName = getWebParamName(opMetaData, i, anWebParam);
            String variable = convertToVariable(wrappedElementName.getLocalPart());

            WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName, javaTypeName, variable, i);
            wrappedParameter.setTypeArguments(convertTypeArguments(javaType, genericType));

            if (mode != ParameterMode.OUT)
               wrappedParameters.add(wrappedParameter);

            if (mode != ParameterMode.IN)
            {
               wrappedParameter.setHolder(true);

               // WrappedParameters can not be shared between request/response objects (accessors)
               if (mode == ParameterMode.INOUT)
                  wrappedParameter = new WrappedParameter(wrappedParameter);
               wrappedOutputParameters.add(wrappedParameter);
            }

            processAttachmentAnnotationsWrapped(scanResult, i, wrappedParameter);
         }
         else
         {
            QName xmlName = getWebParamName(opMetaData, i, anWebParam);

            ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName, javaTypeName);
            paramMetaData.setInHeader(isHeader);
            paramMetaData.setIndex(i);
            paramMetaData.setMode(mode);

            /*
             * Note: The TCK enforces the following rule in the spec regarding
             * partName: "This is only used if the operation is rpc style or if
             * the operation is document style and the parameter style is BARE."
             *
             * This seems to be a flaw in the spec, because the intention is
             * obviously to prevent the ambiguity of wrapped parameters that
             * specify different partName values. There is, however, no reason
             * that this limitation should apply to header parameters since they
             * are never wrapped. In order to comply we adhere to this confusing
             * rule, although I will ask for clarification.
             */
            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);
View Full Code Here

TOP

Related Classes of org.jboss.ws.metadata.umdm.WrappedParameter

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.