Java Class ideal responsibilities with client
<p>I have a class say Test.java and it includes a member variable called errorCode which belongs to the class ErrorCode which is nothing but a wrapper over a int errorCode ... My question is about the setter and getters, what should be the ideal signature for them. The errorCode is an int so the setter would be something like </p>

<pre><code>class Test{
ErrorCode errorCode;
    public void setCode(int errorCode)
    { 
        this.errorCode = new ErrorCode(errorCode);
    }

   public int getCode()
    { 
       return this.errorCode.getCode();
    }
}
</code></pre>

<p>So should, the class create the object and let the client pass in an int or should the client create the object and class only set it to its member variable, ideally should we favor the client or the class ? </p>
