I have the following interface:
public interface GenericMethods {
  public String getString();
}
With this interface, I implemented this enum:
public enum SpecificEnum implements GenericMethods {
  A("NOT"), B("RELATED"), C("TEXT");
  SpecificEnum(String string) {
    this.string = string;
  }
  private String string;
  
  @Override
  public String getString() {
    return this.string;
  }
}
Now, I want to be able to call a function with the parameter SpecificEnum.class and be able to call the values() function on that parameter, as well as the interface methods on the returned array elements. Something like this:
class Main {
  public static void main(String[] args) {
    for (GenericMethods gm : getEnums(SpecificEnum.class)) {
      System.out.printf(gm.getString());
    }
  }
  public static T[]<T extends GenericMethods> getEnums(Class<T> enum1) {
    enum1.values();
  }
}
However, after searching a lot, I haven't come across a case using generics with enums that implement interfaces at the same time. I also thinkered a lot with the generic types but I can't find the right syntax to be able to call values() on a generic enum class. The main objective is to have multiple related enums be managed all in the same way.
 
     
    