title: Static inner classes in scala
body: <p>What is the analog in Scala of doing this in Java:</p>
  
  <pre><code>public class Outer {
    private Inner inner;
  
    public static class Inner {
    }
  
    public Inner getInner() { return inner; }
  }
  </code></pre>
  
  <p>I specifically want my inner class to <strong>not</strong> have to have a fully qualified name - i.e. I want <code>Trade.Type</code>, not <code>TradeType</code>. So in Scala I imagined it might be something like:</p>
  
  <pre><code>class Outer(val inner: Inner) {
      object Inner
  }
  </code></pre>
  
  <p>But this doesn't seem to work: my scala <code>Inner</code> just doesn't seem to be visible from outside the <code>Outer</code> class. One solution would of course be:</p>
  
  <pre><code>class Inner
  class Outer(val inner: Inner)
  </code></pre>
  
  <p>Which is OK - but because of the names of my classes, <code>Inner</code> is really the "type" of the <code>Outer</code> and <code>Outer</code> actually has a long name. So:</p>
  
  <pre><code>class SomeHorriblyLongNameType
  class SomeHorriblyLongName(myType: SomeHorriblyLongNameType)
  </code></pre>
  
  <p>Which is verbose and horrible. I could replace <code>SomeHorriblyLongNameType</code> with just <code>Type</code> but there would then be no obvious connection between it and the class it was related to. Phew</p>