title: Java - Usage of "this" in Enums?
body: <p>I'm trying to create a hierarchy type system using an Enum. I've never used an Enum before.</p>
  
  <p>This method always returns Peasant. I think it's because I am using "this" incorrectly, or maybe I am misunderstanding enums altogether.</p>
  
  <pre><code>public enum Rank {
      PEASANT,
      TRADER,
      SQUIRE,
      MERCHANT,
      KNIGHT,
      NOBLE,
      KING;
  
      public Rank getNextRank() {
          switch (this) {
          case PEASANT:
              return SQUIRE;
          case SQUIRE:
              return KNIGHT;
          case KNIGHT:
              return NOBLE;
          case NOBLE:
              return KING;
          case KING:
              return PEASANT;
          }
          return PEASANT;
      }
  }
  </code></pre>
  
  <p>(I realize that the KING case isn't necessary, but I like it for readability)</p>
  
  <p>I would like <code>Rank.PEASANT.getNextRank()</code> to return <code>Rank.SQUIRE</code> and <code>Rank.NOBLE.getNextRank()</code> to return <code>Rank.KING</code>, etc.</p>