title: Making sure an object will implements an interface
body: <p>I got a class which uses a <code>Proxy</code>. It looks something like this:</p>
  
  <pre><code>public class BarWrapper
  {
      private final Bar bar;
  
      public BarWrapper(Bar bar)
      {
          this.bar = bar;
      }
  
      public int someMethodInBar()
      {
          return bar.someMethodInBar();
      }
  
      public int someMethodInBar2()
      {
          return bar.someMethodInBar2();
      }
  
      public int someMethodInBar3()
      {
          return bar.someMethodInBar3();
      }
  
  
      // etc
  }
  </code></pre>
  
  <p>The <code>Bar</code> is some super class and the dynamic type will be a derivative.</p>
  
  <p>I got an interface and I want the wrapper to implement that interface and keep using the proxy with the same methods, but <code>Bar</code> itself doesn't implement that interface and I don't have any access to it. How can I force the user to pass a dynamic type that is not only a derivative of <code>Bar</code> but also implements the interface so I will have no problem doing this:</p>
  
  <pre><code>(Iinterface)bar.interfaceMethod();
  </code></pre>