title: Casting an object to its original class
body: <p>To avoid having to do this:</p>
  
  <pre><code>if (obj instanceof Class) {
      someHandlingMethod((Class) obj);
  }
  else if (obj instanceof AnotherClass) {
      someHandlingMethod((AnotherClass) obj);
  }
  </code></pre>
  
  <p>Is it possible to automatically cast an Object to its known class as stated by <code>obj.getClass().getName()</code>?</p>
  
  <p>Second to that, is it neat and reliable? Or would it simply be better to use the "Chain of Responsibility" or "Handler" pattern?</p>
  
  <h3>For context:</h3>
  
  <p>The object received in my program is an object read from a ObjectInputStream transmitted over a network. All the objects received are of type 'Message', then I have several subclasses for types of message (such as AuthenticateRequest, ViewRequest). I want to handle these differently.</p>