title: Create an extended "enum" with runtime attributes
body: <p>I want to simplify the selection of a particular predefined object.</p>
  
  <p>I currently have an enum defined as</p>
  
  <pre><code>ArtworkType { Poster, Banner, Other }
  </code></pre>
  
  <p>And I want to add attributes to those ArtworkTypes so that I can use them in code elsewhere. The attributes of the ArtworkTypes are either pre-defined static labels or populated from an external configuration file that is populated into a Properties() class.</p>
  
  <p>Ideally I want to do something as simple as</p>
  
  <pre><code>ArtworkType.Poster.getWidth();
  </code></pre>
  
  <p>If I have to use a final class, I think it's going to be more complicated having to use something like</p>
  
  <pre><code>ArtworkType.getWidth(TypeEnum.Poster);
  </code></pre>
  
  <p><hr />
  <strong>EDIT:</strong> Thanks for the answers below, I conclude that whilst I <em>can</em> do it with an Enum, it's probably better to use an external class (e.g. ArtworkUtil) to retrieve the attributes I'm after.</p>
  
  <p>This is the sample enum code I've created so far (error checking omitted):</p>
  
  <pre><code>public enum ArtworkType {
      Poster("poster"), Banner("banner"), Other("other");
  
      private String type;
      private Dimension dimension;
  
      private ArtworkType(String type) {
          this.type = type;
          this.dimension = new Dimension(Properties.getProperty("width."+type), Properties.getProperty("height."+type);
      }
  
      public Dimension getDimension() {
          return dimension;
      }
  }
  </code></pre>
  
  <p>While I appreciate this is against the principles of strict Enums, as the values that are associated with the Enum are static (for the duration of the application) it might be the lesser of two evils.</p>
  
  <p>The only other approach that I can think of is to create an "ArtworkUtil" class that creates a collection and populates all the required attributes into an object and stores that in the collection.</p>
  
  <p>Accessing that class in the code would make it a lot more unreadable (unless I'm missing something?)</p>