title: Find out if one method could call another
body: <p>I am trying to figure out how to take a Java pojo, and analyze its method for all other methods and function it could call.  For example, here is a hardcoded example of the output.  How can I make this general?  I need to analyze Java objects programmatically to determine what methods they could call if executed.  Example:</p>
  
  <pre><code>package com.example.analyze;
  
  public class Main
  {
  
      private static class Foo {
  
          public void foo(int value, Bar bar) {
              if(value &gt; 5)
                  bar.gaz();
          }
      }
  
      private static class Bar {
  
          public void gaz() {
              System.out.println("gaz");
          }
      }
  
      private static class Analyzer {
  
          public void analyze(Object object){
              System.out.println("Object method foo could call Bar method gaz");
          }
  
      }
  
      public static void main(String[] args)
      {
          Foo foo = new Foo();
          Analyzer analyzer = new Analyzer();
          analyzer.analyze(foo);
      }
  }
  </code></pre>