protected RamlResponse extractResponseFromMethod(Method method,String responseComment){
  RamlModelFactory ramlModelFactory=RamlModelFactoryOfFactories.createRamlModelFactory();
  RamlResponse response=ramlModelFactory.createRamlResponse();
  String mime=extractMimeTypeFromMethod(method);
  RamlMimeType jsonType=ramlModelFactory.createRamlMimeTypeWithMime(mime);
  Class<?> returnType=method.getReturnType();
  Type genericReturnType=method.getGenericReturnType();
  Type inferGenericType=TypeHelper.inferGenericType(genericReturnType);
  if (returnType != null && (returnType.equals(DeferredResult.class) || returnType.equals(ResponseEntity.class))) {
    if (inferGenericType == null) {
      inferGenericType=Object.class;
    }
    if (inferGenericType instanceof Class) {
      returnType=(Class<?>)inferGenericType;
    }
    genericReturnType=inferGenericType;
  }
  jsonType.setSchema(SchemaHelper.convertClassToJsonSchema(genericReturnType,responseComment,javaDocs.getJavaDoc(returnType)));
  LinkedHashMap<String,RamlMimeType> body=new LinkedHashMap<>();
  body.put(mime,jsonType);
  response.setBody(body);
  if (StringUtils.hasText(responseComment)) {
    response.setDescription(responseComment);
  }
 else {
    response.setDescription("Successful Response");
  }
  return response;
}

protected RamlResponse extractResponseFromMethod ( Method method , String responseComment ) { RamlModelFactory ramlModelFactory = RamlModelFactoryOfFactories . createRamlModelFactory ( ) ; RamlResponse response = ramlModelFactory . createRamlResponse ( ) ; String mime = extractMimeTypeFromMethod ( method ) ; RamlMimeType jsonType = ramlModelFactory . createRamlMimeTypeWithMime ( mime ) ; Class < ? > returnType = method . getReturnType ( ) ; Type genericReturnType = method . getGenericReturnType ( ) ; Type inferGenericType = TypeHelper . inferGenericType ( genericReturnType ) ; if ( returnType != null && ( returnType . equals ( DeferredResult . class ) || returnType . equals ( ResponseEntity . class ) ) ) { if ( inferGenericType == null ) { inferGenericType = Object . class ; } if ( inferGenericType instanceof Class ) { returnType = ( Class < ? > ) inferGenericType ; } genericReturnType = inferGenericType ; } jsonType . setSchema ( SchemaHelper . convertClassToJsonSchema ( genericReturnType , responseComment , javaDocs . getJavaDoc ( returnType ) ) ) ; LinkedHashMap < String , RamlMimeType > body = new LinkedHashMap < > ( ) ; body . put ( mime , jsonType ) ; response . setBody ( body ) ; if ( StringUtils . hasText ( responseComment ) ) { response . setDescription ( responseComment ) ; } else { response . setDescription ( "Successful Response" ) ; } return response ; }
extracts the response body from a method in jsonschema format and embeds it into a response object based on the defaultmediatype
