code: public EnumT createAndRegister(String constant) {
      EnumT instance = constructor.apply(constant);
      knownValues.put(constant, instance);
      return instance;
    }
docs: Create a new constant and register it in the known values.