class RegexRuleFilterCreator {

  /**
   * @param className fully qualified class Name of a class implementing {@link RegexRuleFilter}
   */
  public RegexRuleFilter getFilter(String className) {<FILL_FUNCTION_BODY>}
 
}

    try {
      Class<?> aClass = JLanguageTool.getClassBroker().forName(className);
      Constructor<?>[] constructors = aClass.getConstructors();
      if (constructors.length != 1) {
        throw new RuntimeException("Constructor of filter class '"
                + className + "' must have exactly one constructor, but it has " + constructors.length);
      }
      Constructor<?> constructor = constructors[0];
      try {
        if (constructor.getParameterTypes().length != 0) {
          throw new RuntimeException("Constructor of filter class '" + className + "' must not have arguments: " + constructor);
        }
        Object filter = constructor.newInstance();
        if (filter instanceof RegexRuleFilter) {
          return (RegexRuleFilter) filter;
        } else {
          throw new RuntimeException("Filter class '" + className + "' must implement interface " + RegexRuleFilter.class.getSimpleName());
        }
      } catch (Exception e) {
        throw new RuntimeException("Could not create filter class using constructor " + constructor, e);
      }
    } catch (ClassNotFoundException e) {
      throw new RuntimeException("Could not find filter class: '"
              + className + "' - make sure to use a fully qualified class name like 'org.languagetool.rules.MyFilter'");
    }
  
<no_super_class>