Refactoring local variables to an object that I will return
<p>I have a result object like:</p>

<pre><code>public class ActionResult {
   int ...
   String ...
   Boolean ..
}
</code></pre>

<p>And my method:</p>

<pre><code>public ActionResult getAbc(..) {

   String string1;
   Boolean bool1;
   int int1;

   string1 = someDao.get(p1);

   if(string1 != null) {
       bool1 = someDao.getB(string1);
   }

}
</code></pre>

<p>Now I want to replace this with my <code>ActionResult</code> object, but finding it looks messy and I have to convert the values, but the value may be null and my set calls will fail then correct?</p>

<p>Example:</p>

<pre><code>if(result.getString1() != null) {
    result.setBool1( someDao.getB1(result.getString1()) );
}
</code></pre>

<p>The problem is, the result of calling <code>getB1</code> actually returns a string (3rd party lib I can't change that), that I then have to cast to a boolean.</p>

<pre><code>result.setBool1( Boolean.parseBoolean( someDao.getB1(result.getString1()) ) );
</code></pre>

<p>Also, the call to <code>getB1</code> may return null, now what?
It just seems the code looks very messy and hard to read don't you think?</p>
