title: Is using an object instantiation as an enum entry's value good practice?
body: <p>First off, apologies if this is a duplicate of an existing question. Wasn't precisely sure how to word my question so that may be why I haven't found a clear answer yet. Essentially, I want to know if the following is considered good practice or if there is a better way to do this:</p>
  
  <pre><code>public enum ExampleEnum {
      ENTRY_1(new ExampleCodedValue("entry1", "comment1")),
      ENTRY_2(new ExampleCodedValue("entry2", "comment2")),
      ENTRY_3(new ExampleCodedValue("entry3", "comment3")),
      ENTRY_4(new ExampleCodedValue("entry4", "comment4"));
  
      private ExampleCodedValue codedValue;
  
      ExampleEnum(ExampleCodedValue codedValue) {
          this.codedValue = codedValue;
      }
  
      public ExampleCodedValue getCodedValue() {
          return codedValue;
      }
  }
  
  class ExampleCodedValue {
  
      private final String code;
      private final String comment;
  
      ExampleCodedValue(String code, String comment) {
          this.code = code;
          this.comment = comment;
      }
  }
  </code></pre>