Java - Passing a Symbolic Class Object to a Method : <p>I am writing a generic method that will set a specific object of a class. Say I have this:</p>

<pre><code>public class MyRecord {
    public String name;
    public String comment;
}
</code></pre>

<p>In my method I will pass an instance of MyRecord to the constructor and keep it:</p>

<pre><code>public class Processor {
    private MyRecord rec;
    public Processor(MyRecord rec_) {
        rec=rec_;
    }
    .
    .
    .
    public void doIt(Object object_) {
        rec.object_=&lt;Something&gt;;
    }
}
</code></pre>

<p>When I call doIt, I want to pass which object of MyRecord to set in the method. I know I can do a different method for each element but that is not my question. Is this or something similar possible and if so how? Maybe what I am looking for is a way to emulate pass by reference. TIA.</p>
