/**
   * Extract the id from a method element and add to the method map. Also extract the ids from any
   * contained representation or fault elements.
   *
   * @param file the URI of the current WADL file being processed
   * @param m the method element
   * @throws javax.xml.bind.JAXBException if the WADL file is invalid or if the code generator
   *     encounters a problem.
   * @throws java.io.IOException if the specified WADL file cannot be read.
   */
  protected void extractMethodIds(Method m, URI file) throws JAXBException, IOException {
    processIDHref(file, m.getId(), m.getHref(), m);

    if (m.getRequest() != null) {
      for (RepresentationType r : m.getRequest().getRepresentation())
        extractRepresentationId(r, file);
    }
    if (m.getResponse() != null) {
      for (JAXBElement<RepresentationType> child : m.getResponse().getRepresentationOrFault()) {
        extractRepresentationId(child.getValue(), file);
      }
    }
  }
 /**
  * Add a method to a resource. Follow references to methods across WADL file boundaries
  *
  * @param method the WADL method element to process
  * @param resource the resource
  * @param file the URI of the current WADL file being processed
  */
 protected void addMethodToResource(ResourceNode resource, Method method, URI file) {
   String href = method.getHref();
   if (href != null && href.length() > 0) {
     // dereference resource
     if (!href.startsWith("#")) {
       // referecnce to element in another document
       file = getReferencedFile(file, href);
     }
     method = dereferenceLocalHref(file, href, Method.class);
   }
   if (method != null) {
     MethodNode n = new MethodNode(method, resource);
     Request request = method.getRequest();
     if (request != null) {
       for (Param p : request.getParam()) {
         n.getQueryParameters().add(p);
       }
       for (RepresentationType r : request.getRepresentation()) {
         addRepresentation(n.getSupportedInputs(), r, file);
       }
     }
     Response response = method.getResponse();
     if (response != null) {
       for (JAXBElement<RepresentationType> o : response.getRepresentationOrFault()) {
         if (o.getName().getLocalPart().equals("representation")) {
           addRepresentation(n.getSupportedOutputs(), o.getValue(), file);
         } else if (o.getName().getLocalPart().equals("fault")) {
           FaultNode fn = new FaultNode(o.getValue());
           n.getFaults().add(fn);
         }
       }
     }
   }
 }