public static String getRuleId(Class<?> clazz) {
    Optional<String> optionalCustomValidationRule = EP_NAME.getExtensionList()
      .stream()
      .filter(customValidationRule -> customValidationRule.getClass() == clazz)
      .map(rule -> rule.getRuleId())
      .findFirst();

    if (optionalCustomValidationRule.isEmpty()) {
      optionalCustomValidationRule = Arrays.stream(CustomValidationRuleFactory.EP_NAME.getExtensions())
        .filter(factory -> factory.getRuleClass() == clazz)
        .map(factory -> factory.getRuleId())
        .findFirst();

      if (optionalCustomValidationRule.isEmpty()) {
        throw new IllegalStateException(String.format("CustomValidationRule instance is not found for class %s.", clazz.getName()));
      }
    }

    return optionalCustomValidationRule.get();
  }
public static String getRuleId(Class<?> clazz)