Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws;
 
 import java.util.List;
 
 
 
 public class RequestWrapper extends Wrapper {
     @Override
     public void setOperationInfo(final OperationInfo op) {
         super.setOperationInfo(op);
         setName(op.getInput().getMessageParts().get(0).getElementQName());
         setClassName((String)op.getInput().getMessageParts().get(0).getProperty("REQUEST.WRAPPER.CLASSNAME"));
     }
 
     @Override
     public boolean isWrapperAbsent(final Method method) {
         javax.xml.ws.RequestWrapper reqWrapper = method.getAnnotation(javax.xml.ws.RequestWrapper.class);
         return getClassName() == null && (reqWrapper == null || StringUtils.isEmpty(reqWrapper.className()));
     }
 
     public String getWrapperTns(Method method) {
         javax.xml.ws.RequestWrapper reqWrapper = method.getAnnotation(javax.xml.ws.RequestWrapper.class);
         if (reqWrapper != null) {
             return reqWrapper.targetNamespace();
         }
         return null;
     }
 
     @Override
     protected List<JavaFieldbuildFields() {
     }    
     
     protected List<JavaFieldbuildFields(final Method methodfinal MessageInfo message) {
         List<JavaFieldfields = new ArrayList<JavaField>();
 
         final Type[] paramClasses = method.getGenericParameterTypes();
         final Annotation[][] paramAnnotations = method.getParameterAnnotations();
 
         for (MessagePartInfo mpi : message.getMessageParts()) {
             int idx = mpi.getIndex();
             String name = mpi.getName().getLocalPart();
             Type t = paramClasses[idx];
             String type = getTypeString(t);
 
             JavaField field = new JavaField(nametype"");
 
             if (paramAnnotations != null 
                 && paramAnnotations.length == paramClasses.length) {
                 WebParam wParam = getWebParamAnnotation(paramAnnotations[idx]);
                 if (wParam != null && !StringUtils.isEmpty(wParam.targetNamespace())) {
                     field.setTargetNamespace(wParam.targetNamespace());
                 } else {
                     field.setTargetNamespace("");
                 }
             }
 
             List<AnnotationjaxbAnns = WrapperUtil.getJaxbAnnotations(methodidx);
             field.setJaxbAnnotations(jaxbAnns.toArray(new Annotation[jaxbAnns.size()]));
             fields.add(field);
         }
 
         return fields;
     }
 
     @Override
     public WrapperBeanClass getWrapperBeanClass(final Method method) {
         javax.xml.ws.RequestWrapper reqWrapper = method.getAnnotation(javax.xml.ws.RequestWrapper.class);
         javax.jws.WebMethod webMethod = method.getAnnotation(javax.jws.WebMethod.class);
        String methName = webMethod == null ? null : webMethod.operationName();
        if (StringUtils.isEmpty(methName)) {
            methName = method.getName();
        }
        String reqClassName = getClassName();
        String reqNs = null;
        if (reqWrapper != null) {
            reqClassName = reqWrapper.className().length() > 0 ? reqWrapper.className() : reqClassName;
            reqNs = reqWrapper.targetNamespace().length() > 0 ? reqWrapper.targetNamespace() : null;
        }
        if (reqClassName == null) {
            reqClassName = getPackageName(method) + ".jaxws." + StringUtils.capitalize(methName);
        }
        WrapperBeanClass jClass = new WrapperBeanClass();
        jClass.setFullClassName(reqClassName);
        jClass.setNamespace(reqNs);
        return jClass;
    }
New to GrepCode? Check out our FAQ X