title: Typed subsets of enums
body: <p>Let's say I have the following <code>enum</code> type:</p>
  
  <pre><code>public enum Country {
      CHINA,
      JAPAN,
      FRANCE,
      // ... and all other countries
      AUSTRIA,
      POLAND;
  }
  </code></pre>
  
  <p>Now I would to create a subset of this enum, conceptually like:</p>
  
  <pre><code>public enum EuropeanUnion constraints Country {
      FRANCE,
      // ... and all other countries within the European Union
      AUSTRIA,
      POLAND;
  }
  
  public enum LandlockedCountries constraints Country {
      // ... all landlocked countries
      AUSTRIA;
  }
  </code></pre>
  
  <p>I'd like to create subsets of an <code>enum</code> type so that I can write methods such as</p>
  
  <pre><code>Set&lt;Person&gt; getNationalMembersOfEuropeanParliament(EuropeanUnion euCountry);
  </code></pre>
  
  <p>Using the subtype <code>EuropeanUnion</code> for parameter <code>euCountry</code> protects the API user from accidentally passing in an invalid country, e.g. the non-EU <code>JAPAN</code>.</p>
  
  <p>Are there any ways of "constraining" the range of valid enum values so that one can benefit from the static type system?</p>