code: private <T extends Enum<T>> Object[] getValidEnumConstants(Class<T> valueClass) {
          T[] constants = valueClass.getEnumConstants();
          if (!VersionedEnum.class.isAssignableFrom(valueClass)) {
              return constants;
          }
  
          List<T> valid = new ArrayList<T>(constants.length);
          for (T value : constants) {
              VersionedEnum versionedValue = (VersionedEnum) value;
              if (version >= versionedValue.getMinVersion()) {
                  valid.add(value);
              }
          }
  
          return valid.toArray();
      }
docs: Return an array of the constants for the enum that are valid based on the
  version of this parser.