title: Enums with interface - how to do so generically?
body: <p>If I have a set of enums, and want to have them all implement an interface, is this the correct way to do generically? </p>
  
  <p>Enum:</p>
  
  <pre><code>public enum MentalSkill implements SkillType {
      ACADEMICS,COMPUTER,CRAFTS,INVESTIGATION,MEDICINE,OCCULT,POLITICS,SCIENCE;
      private static final int UNTRAINED_PENALTY = -3;
      @Override
      public SkillType fromValue(String value) {
          return valueOf(value);
      }
      @Override
      public int getUntrainedPenalty() {
          return UNTRAINED_PENALTY;
      }
  }
  </code></pre>
  
  <p>Interface:</p>
  
  <pre><code>public interface SkillType {
  
  SkillType fromValue(String value);  
  int getUntrainedPenalty();
  }
  </code></pre>
  
  <p>Holding Class (where my suspcions lie that this is not quite right):</p>
  
  <pre><code>public class SkillsSet&lt;T extends SkillType&gt; {
      T t;
      Map&lt;T,Integer&gt; skills = new HashMap&lt;&gt;();
      public SkillsSet(String[] skills) {
          for (String string : skills) {
              addSkill(string,t.getUntrainedPenalty());
          }
      }
      private void addSkill(String skillString,Integer value) {
          skills.put((T) t.fromValue(skillString), 0);
      }
  }
  </code></pre>
  
  <p>The issue comes in my <code>T t</code> which will obviously give a NPE as I don't instantiate my inferred type. The issue is that I can't, as it's an enum.</p>
  
  <p>What's the Java way of saying 'Use this interface to access an enum method generically.'? Throwing in <code>skills.put(T.fromValue(skillString), 0);</code> doesn't work, which was my next guess.</p>
  
  <p>I've looked over the tutorials (which is how I've gotten this far) and I couldn't seem to see how to get any further. How do I get this code to work?</p>