Final attribute initialized AFTER the object instantiation
<p>Well, I've a final property but I don't want to initialize it when I create my object because I can't. So I tried to not initialize it in my constructor but using a setter, I guessed it would have been something like a only-one-time usable setter, but I've this error :</p>

<blockquote>
  <p>Test.java:27: error: cannot assign a value to final variable foo</p>

<pre><code>    this.foo = new String(foo);
</code></pre>
</blockquote>

<p>Here is a short code I used to test this :</p>

<pre><code>class Test {

    private final String foo;

    public static void main(String[] args) {
        Test test = new Test();
        test.setFoo("gygygy");
        System.out.println(test.getFoo());
    }

    public Test() {
        System.out.println("Constructor");
    }

    public String getFoo() {
        return foo;
    }

    public void setFoo(String foo) {
        this.foo = foo;
    }

}
</code></pre>

<p>So I assume the constructor implicitly makes something like this.foo = new String(); or this.foo = null; and I think I can't modify this behavior, but how can I have an equivalent to what I wanna do ? I think in something like :</p>

<pre><code>private String foo;

/* ... */

public void setFoo(String foo) {
    if( !(this.foo.isInitialized()) )
        this.foo = foo;
}
</code></pre>

<p>but the Object.isInitialized() method obviously doesn't exist, and I can't find an equivalent x)</p>

<p>So here's my question in a few words : How can I do ? I want a <em>final attribute</em> that is <em>not initialized at the instantiation of the object</em>.</p>

<p>Thanks !</p>
