Class.getArrayType in Java?
<p>I use the following trick to get the array type of a specific class: </p>

<pre><code>@SuppressWarnings("unchecked")
public static &lt;T&gt; Class&lt;T[]&gt; getArrayType(Class&lt;T&gt; componentType) {
    String arrayClassName = "[L" + componentType.getName() + ";";
    try {
        return (Class&lt;T[]&gt;) Class.forName(arrayClassName);
    } catch (ClassNotFoundException e) {
        throw new UnexpectedException("Can't get the array type for " + componentType, e);
    }
}
</code></pre>

<p>But, is there any more elegant way to get this?</p>
