title: Can a Java class add a method to itself at runtime?
body: <p>Can a class add a method to itself at runtime (like from a <code>static</code> block), so that if someone is performing reflection on this class, they'll see the new method, even though it wasn't defined at compile time?</p>
  
  <p><em><strong>Background:</em></strong></p>
  
  <p>A framework I'm using expects <code>Action</code> classes to be defined that have a <code>doAction(...)</code> method, by convention. The framework inspects these classes at runtime to see what type of parameters are available in their <code>doAction()</code> method. For example: doAction(<strong>String</strong> a, <strong>Integer</strong> b)</p>
  
  <p>I'd like each class to be able to programatically generate its <code>doAction()</code> method with various parameters, just-in-time when it is inspected.  The body of the method can be empty.</p>