title: How to check if a java class has a particular method in it?
body: <p>I have an xml schema (generated automatically using trang) which keeps changing. These changes are not very elaborate. Only some elements are added or deleted from this schema. From this schema, I am generating java classes (using cxf) by which I will unmarshall the xml document. </p>
  
  <p>As schema changes, my auto-generated java classes also change. Again, as with schema, changes in java classes are not very big. For instance, if an element say <code>elemA</code> is added to schema; some related functions say <code>getElemA()</code> and <code>setElemA()</code> are added to auto-generated java class. </p>
  
  <p>Now how would I make sure that a particular function exists in these auto-generated classes? One solution is to hand-write the schema such that all possible elements of xml are covered. This is what I'll ultimately do. But for now, I have not fixed the format of xml file.</p>
  
  <p>UPDATE :</p>
  
  <p>There is a possibility that a method <code>getElemA()</code> may be defined in auto-generated classes. I do not have control over the auto-generation of these classes. But in my main class, if have following code,</p>
  
  <pre><code>If method getElemA exists then 
       ElemA elemA = getElemA()
  </code></pre>
  
  <p>This code will always be there in my main class. If method <code>getElemA()</code> is generated in one of the auto-generated class then there is no problem. But if this method is not generated then compilers complain that this method does not exists in any of the class.</p>
  
  <p>Is there any way that I can make compiler not to complain about this function at compile time?</p>