private IMethodModel processMethod(CtMethod<?> m, TypeModel ownerType) {

    MethodModel methodModel = new MethodModel();
    fillBasic(methodModel, m);
    fillTypeParameters(methodModel, m);
    CtTypeReference<?> returnedType = m.getType();
    ITypeModel returnedTypeModel = processTypeReference(returnedType);
    methodModel.setReturnedType(returnedTypeModel);
    fillJAXBType(methodModel, returnedType);

    List<CtParameter<?>> parameters = m.getParameters();
    for (CtParameter<?> p : parameters) {
      IParameterModel parameterModel = processParameter(p);
      methodModel.addParameter(parameterModel);
    }
    String returnedTypeSimpleName = returnedType.getSimpleName();
    String returnedTypeQualifiedname = returnedType.getQualifiedName();
    if (returnedTypeSimpleName.equalsIgnoreCase(returnedTypeQualifiedname)) {
      for (ITypeParameter tp : ownerType.getTypeParameters()) {
        if (returnedType.getSimpleName().equals(tp.getName())) {
          methodModel.setHasGenericReturnType(true);
        }
      }
      for (ITypeParameter tp : methodModel.getTypeParameters()) {
        if (returnedType.getSimpleName().equals(tp.getName())) {
          methodModel.setHasGenericReturnType(true);
        }
      }
    }
    return methodModel;
  }
  private IMethodModel processMethodReference(CtExecutableReference<?> methodElement) {

    MethodModel methodModel = new MethodModel();
    fillReference(methodModel, methodElement);
    List<CtTypeReference<?>> parameters = methodElement.getParameters();
    Method actualMethod = methodElement.getActualMethod();
    if (actualMethod != null) {
      String canonicalName = actualMethod.getReturnType().getCanonicalName();
      ITypeModel existingType = registry.getType(canonicalName);
      if (existingType != null) {
        methodModel.setReturnedType(existingType);
      }
      if (existingType != null) {
        methodModel.setReturnedType(new ProxyType(registry, canonicalName));
      }
      adjustModifiers(methodModel, actualMethod);
    }
    for (CtTypeReference<?> p : parameters) {
      IParameterModel parameterModel = processParameterReference(p);
      methodModel.addParameter(parameterModel);
    }
    return methodModel;
  }
  private void adjustReturnedAndBodyType(IMethodModel method_, boolean hasGlobalConsumes) {

    if (!(method_ instanceof MethodModel)) {
      return;
    }
    MethodModel method = (MethodModel) method_;

    ITypeModel returnedType = method.getReturnedType();
    if (returnedType != null) {
      if (returnedType instanceof ProxyType) {
        ITypeModel rt = registry.getType(returnedType.getFullyQualifiedName());
        method.setReturnedType(rt);
      }
    }

    boolean hasConsumes = hasGlobalConsumes;

    IAnnotationModel apiOperation = method.getAnnotation(API_OPERATION);
    if (apiOperation != null) {
      IAnnotationModel[] subAnn = apiOperation.getSubAnnotations(JAVAX_CONSUMES.toLowerCase());
      if (subAnn != null) {
        hasConsumes = true;
      }
    }

    IAnnotationModel consumes = method.getAnnotation(JAVAX_CONSUMES);
    if (consumes != null) {
      hasConsumes = true;
    }
    if (!hasConsumes) {
      return;
    }

    IParameterModel[] parameters = method.getParameters();
    for (IParameterModel param_ : parameters) {

      String paramType = param_.getParameterType();
      //			if(paramType.startsWith("java.")){
      //				continue;
      //			}
      if (isPrimitive(paramType)) {
        continue;
      }
      if (param_.hasAnnotation("QueryParam")) {
        continue;
      }
      if (param_.hasAnnotation("HeaderParam")) {
        continue;
      }
      if (param_.hasAnnotation("PathParam")) {
        continue;
      }
      if (param_.hasAnnotation("FormParam")) {
        continue;
      }
      if (param_.hasAnnotation("Context")) {
        continue;
      }

      ITypeModel type = registry.getType(paramType);
      if (type == null) {
        continue;
      }
      //			IAnnotationModel typeAnnotation = type.getAnnotation(JAVAX_XML_TYPE);
      //			if(typeAnnotation==null){
      //				continue;
      //			}
      method.setBodyType(type);
      if (registry.isTargetType(paramType)) {
        break;
      }
    }
  }