title: Java : How to create a function that can only accept object which is an Interface?
body: <p>I need to write a function that accepts an object , but I want to enforce in the function call (not after the function is called) that the object is an interface.</p>
  
  <p>Meaning , I want to make sure this is an Interface at compile time , not on run time. </p>
  
  <p>What do I mean? </p>
  
  <pre><code>interface ISomething {...} 
  class A implements ISomething { ... }
  ISomething something = new A(); 
  MyClass.register(something);
  </code></pre>
  
  <p>In this example , the passed object is an interface  , and I want that the MyClass.register function to enforce the this requirment in it's declaration. </p>
  
  <p>I don't know which interface I'm going to get , and there is no use defining another interface to be implemented by all other implementation , because I need the real interface. </p>