title: List out declared methods of a Groovy class from Java
body: <p>I have a groovy file named <code>sample.groovy</code>, which contains different methods:</p>
  
  <pre><code>class sample {
  
      def doOperation()
      {
          println("Inside doOperation()")
      }
  
      def setData(String str)
      {  
          println("Incoming data : " + str)
      }   
  }
  </code></pre>
  
  <p>I have defined only 2 methods: <code>doOperation()</code> and <code>setData()</code>, and I want to list out these 2 methods only.</p>
  
  <p>I have used reflection and try to list out methods using <code>getDeclaredMethods()</code>. But it list out above methods and methods like: <code>setProperty</code>, <code>getProperty</code>, <code>setMetaClass</code>, etc.</p>
  
  <p>I want to list out the methods defined in this particular file only.</p>