/**
  * value.
  *
  * @param cl a {@link java.lang.Class} object.
  * @param name a {@link java.lang.String} object.
  * @return a {@link java.lang.String} object.
  */
 public String value(Class<? extends Annotation> cl, String name) {
   IAnnotationModel annotation = originalType.getAnnotation(cl.getSimpleName());
   if (annotation != null) {
     return annotation.getValue(name);
   }
   return null;
 }
  private boolean hasGlobalConsumes(ITypeModel type) {

    if (type.hasAnnotation(JAVAX_CONSUMES)) {
      return true;
    }
    IAnnotationModel apiAnn = type.getAnnotation(SWAGGER_API);
    if (apiAnn == null) {
      return false;
    }
    String consumes = apiAnn.getValue(JAVAX_CONSUMES.toLowerCase());
    if (consumes != null) {
      return true;
    }
    return false;
  }
  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;
      }
    }
  }