Creating an immutable object after a certain operation
<p>I'm new to Java so I wanted to know whether its possible to do this ?
I have a document object say Document doc1 .. once I use a jdom builder to build this object I don't want it to be changed ever .. also it needs to be always available .. i believe the latter can be done using the static keyword .. how do I make sure that once I use the jdom builder no one can ever modify this object ? So in the following what should be the declaration in the class to make sure templateDocument cannot be modified once I build it using builder ..</p>

<pre><code>public static void createDocumentFromTemplate(StatusBuffer statusBuffer)
{
    //templateDocument = new Document();
    SAXBuilder builder = new SAXBuilder();
    Reader input = new StringReader(statusBuffer.toString());
    try {
        templateDocument = builder.build(input);
    } catch (JDOMException e) {
        final String message = "Error in building xml from output template";
        LOG.error(message, e);

    } catch (IOException e) {
        final String message = "Error in accessing output file template";
        LOG.error(message, e);

    }
</code></pre>
