title: Scala BigDecimal in a case class and forcing a MathContext
body: <p>I am trying to create a <code>case class</code> that holds a <code>BigDecimal</code> as a value with a certain <code>MathContext</code> (RoundUp, Precision 2). The documentation said <code>BigDecimal.mc</code> is a <code>val</code>, so no simple reassignment. So I came up with two solutions. First this one</p>
  
  <pre><code>case class Test(number: BigDecimal)
  
  object Test {
      def apply(n) = new Test(n, new java.math.MathContext(2))
  } 
  </code></pre>
  
  <p>I didn't like that one because it can be circumnavigated with the <code>new</code> keyword.</p>
  
  <pre><code>case class Test(var number: BigDecimal){
      number = BigDecimal(number.toString, new java.math.MathContext(2))
  }
  </code></pre>
  
  <p>That second one works, but is ugly as hell and creates additional overhead. I am just wondering if I overlook something simple and elegant.</p>