title: How to get all the variables of a groovy object or class?
body: <p>To see list of methods in a class I can do this - </p>
  
  <pre><code>String.methods.each {println it}
  </code></pre>
  
  <p>How do I list all the variables of an instance or all the static variables of a class?</p>
  
  <p><strong>Edit1:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/hWDJJ.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/0JCJd.png" alt="enter image description here"></p>
  
  <p><strong>Edit2:</strong></p>
  
  <p>HoneyBadger.java</p>
  
  <pre><code>public class HoneyBadger {
      public int badassFactor;
      protected int emoFactor;
      private int sleepTime;
  }
  </code></pre>
  
  <p>test.groovy - </p>
  
  <pre><code>HoneyBadger.metaClass.properties.each {println it.name }
  </code></pre>
  
  <p>Output - </p>
  
  <pre><code>class
  </code></pre>