title: How do I "get" a Scala case object from Java?
body: <p>I created a hierarchy of case objects in Scala that looks like the following:</p>
  
  <pre><code>package my.awesome.package
  
  sealed abstract class PresetShapeType(val displayName: String)
  
  case object AccelerationSensor extends PresetShapeType("Acceleration Sensor")
  case object DisplacementSensor extends PresetShapeType("Displacement Sensor")
  case object ForceSensor        extends PresetShapeType("Force Sensor")
  case object PressureSensor     extends PresetShapeType("Pressure Sensor")
  case object StrainSensor       extends PresetShapeType("Strain Sensor")
  </code></pre>
  
  <p>I also have a piece of Java code in which I'd like to access <code>PressureSensor</code>, but the following does not work:</p>
  
  <pre><code>package my.awesome.package.subpackage;
  
  import my.awesome.package.PressureSensor;
  
  // Do some stuff, then...
  
  DVShape newshape = DVShapeFactory.createPresetShape(PressureSensor, new Point3f(0,0,0));
  </code></pre>
  
  <p>So, how do I reference the <code>PressureSensor</code> case object from Java? I decompiled the byte code for both the <code>PressureSensor</code> and <code>PressureSensor$</code> classes, which yielded the following:</p>
  
  <pre><code>Compiled from "DVShapeFactory.scala"
  public final class org.nees.rpi.vis.PressureSensor extends java.lang.Object{
      public static final java.lang.Object productElement(int);
      public static final int productArity();
      public static final java.lang.String productPrefix();
      public static final int $tag();
      public static final java.lang.String displayName();
  }
  
  Compiled from "DVShapeFactory.scala"
  public final class org.nees.rpi.vis.PressureSensor$ extends org.nees.rpi.vis.PresetShapeType implements scala.ScalaObject,scala.Product,java.io.Serializable{
      public static final org.nees.rpi.vis.PressureSensor$ MODULE$;
      public static {};
      public org.nees.rpi.vis.PressureSensor$();
      public java.lang.Object readResolve();
      public java.lang.Object productElement(int);
      public int productArity();
      public java.lang.String productPrefix();
      public final java.lang.String toString();
      public int $tag();
  }
  </code></pre>
  
  <p>But that didn't yield any great insight.</p>