title: Add inter-type public static method to classes
body: <p>in my project I have a set of classes (whose names and number I don't apriori) which I want to add a public static method to.</p>
  
  <p>For simplicity, let assume that I want to add a static method which returns the static logger instance of the class. The only requirement is that the static function should be called as follows:</p>
  
  <pre><code>public class Foo {
      private static final Logger LOG = LoggerFactor.getLogger(Foo.class);
  
      public static void main(String[] args) {
          Foo.getLogger().info("works!");
      }
  }
  </code></pre>
  
  <p>Since I think this a cross cutting concern I think solving my issue with AspectJ here, but I didn't find any information about my scenario.</p>
  
  <p>My questions are:</p>
  
  <ul>
  <li><strong>if this is even possible?</strong></li>
  <li><strong>if so, how can you achieve it?</strong></li>
  </ul>
  
  <p>I'm aware of the possibility of dyamically declare the parent of my classes implementing an interface, but then I'm stuck because I cannot generate static methods on interface:</p>
  
  <pre><code>public aspect StaticMethodAspect {
  
      public interface HasStaticMethod {}
  
      declare parents: ... implements HasStaticMethod;
  
      public static Logger HasStaticMethod.getLogger() { //aspect error
          ...
      }
  
  }
  </code></pre>
  
  <p>And I'm also aware of <a href="https://stackoverflow.com/a/20638028/1887602">this solution</a>, but it doesn't meet my requirement about the way of call the method.</p>
  
  <p>Thanks for any kind reply</p>