title: Generating Enums Dynamically
body: <p>Let's say I have a file whose format is basic XML, like so:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;enum-set&gt;
      &lt;enum&gt;
          &lt;name&gt;SomeEnum&lt;/name&gt;
          &lt;values&gt;
              &lt;value&gt;
                  &lt;name&gt;SOMEVALUE&lt;/name&gt;
                  &lt;displayText&gt;This is some value&lt;/displayText&gt;
               &lt;/value&gt;
              ... more values ...
          &lt;/values&gt;
      &lt;/enum&gt;
      ... more enums ...
  &lt;/enum-set&gt;
  </code></pre>
  
  <p>and I wanted to turn <code>SomeEnum</code> into something like this at runtime:</p>
  
  <pre><code>public enum SomeEnum implements HasDisplayText {
      SOMEVALUE("This is some value"),
      ... more values ...;
  
      private String displayText;
  
      SomeEnum(String displayText) {
          this.displayText = displayText;
      }
  
      @Override
      public String getDisplayText() {
          return displayText;
      }
  }
  </code></pre>
  
  <p>... and then pass the newly created enum <code>SomeEnum</code> around my application. How might I achieve something like this? Is it doable?</p>