What is the best way to check if a field is final in java using reflection?
<p>I'm writing a class, which, at some point, has to have all its fields assigned from an other item of this class.</p>

<p>I did it through reflection:</p>

<pre><code>        for(Field f:pg.getClass().getDeclaredFields()){
            f.set(this, f.get(pg));
        }
</code></pre>

<p>The problem is, that this class contains a field, which is final. I could skip it by name, but to me that seems not elegant at all.</p>

<p>What's the best way to check if a field is final in java using reflection?</p>
