/**
   * Extracts class information from a (believe it or not) java class as well as the contained
   * methods.
   *
   * @param clazz The Class to be inspected
   * @return The RAML Resource model for this class
   */
  public RamlResource extractResourceInfo(Class<?> clazz) {
    logger.info("Parsing resource: " + clazz.getSimpleName() + " ");
    RamlResource resource =
        RamlModelFactoryOfFactories.createRamlModelFactory().createRamlResource();
    resource.setRelativeUri("/" + getResourceName(clazz));
    resource.setDisplayName(clazz.getSimpleName()); // TODO allow the Api annotation to specify
    // this stuff :)
    JavaDocStore javaDoc = javaDocs.getJavaDoc(clazz);
    String comment = javaDoc.getJavaDocComment(clazz);
    if (comment != null) {
      resource.setDescription(comment);
    }

    // Append stuff to the parent resource
    getMethodsFromService(clazz, javaDoc, resource);

    return resource;
  }
 /**
  * Loads the relevant methods from a service and extracts the information relevant to raml.
  * Methods from the Object class are ignored
  *
  * @param clazz
  * @return
  */
 private void getMethodsFromService(
     Class<?> clazz, JavaDocStore javaDoc, RamlResource parentResource) {
   try {
     for (Method method : clazz.getMethods()) {
       if (!IGNORE_METHOD_REGEX.matcher(method.getName()).matches()
           && shouldAddMethodToApi(method)) {
         extractAndAppendResourceInfo(method, javaDoc.getJavaDoc(method), parentResource);
       }
     }
   } catch (NoClassDefFoundError nEx) {
     logger.error("Unable to get methods - skipping class " + clazz, nEx);
   }
 }