title: How to check if an object is an array of a certain type
body: <p>I have an object <code>Field field</code>.</p>
  
  <p>I'd like to check if <code>field</code> is either an object of type <code>Foo</code> or an array: <code>Foo[]</code>.</p>
  
  <p>Psuedo code:</p>
  
  <pre><code>if field.getType() is Foo || field.getType is Foo[]
  </code></pre>
  
  <p>Is this possible?</p>
  
  <p>I've tried</p>
  
  <pre><code>if (field.getType().isArray())
      // do something
  </code></pre>
  
  <p>But this would only allow me to check if <code>field</code> is an array.</p>
  
  <p>Doing this, on the contrary, will only check if it's an object of <code>Foo</code></p>
  
  <pre><code>if (Foo.class.isAssignableFrom(field.getType())
       // do something
  </code></pre>
  
  <p>Any idea how to do this?</p>
  
  <p>Thanks.</p>