@Test void getConfigurationsDoesNotReturnsDeprecatedOnes() { List<ValidatorConfiguration> configurations = ValidatorFactory.getConfigurations("en"); assertTrue(configurations.stream().filter(s->s.toString().equals("SentenceLength")).count() == 1); assertTrue(configurations.stream().filter(s->s.toString().equals("SpaceBeginningOfSentence")).count() == 0); }
public static List<ValidatorConfiguration> getConfigurations(String lang) { List<ValidatorConfiguration> configurations = validators.entrySet().stream().filter(e -> { List<String> supportedLanguages = e.getValue().getSupportedLanguages(); boolean deprecated = e.getValue().getClass().getAnnotation(Deprecated.class) == null ? false : true; return (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) && !deprecated; }).map(e -> new ValidatorConfiguration(e.getKey(), toStrings(e.getValue().getProperties()))).collect(toList()); Map<String, String> emptyMap = new LinkedHashMap<>(); for (String jsValidator : jsValidators.keySet()) { try { Validator jsValidatorInstance = getInstance(jsValidator); List<String> supportedLanguages = jsValidatorInstance.getSupportedLanguages(); if (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) { configurations.add(new ValidatorConfiguration(jsValidator, emptyMap)); } } catch (RedPenException ignored) { } } return configurations; }
ValidatorFactory { public static List<ValidatorConfiguration> getConfigurations(String lang) { List<ValidatorConfiguration> configurations = validators.entrySet().stream().filter(e -> { List<String> supportedLanguages = e.getValue().getSupportedLanguages(); boolean deprecated = e.getValue().getClass().getAnnotation(Deprecated.class) == null ? false : true; return (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) && !deprecated; }).map(e -> new ValidatorConfiguration(e.getKey(), toStrings(e.getValue().getProperties()))).collect(toList()); Map<String, String> emptyMap = new LinkedHashMap<>(); for (String jsValidator : jsValidators.keySet()) { try { Validator jsValidatorInstance = getInstance(jsValidator); List<String> supportedLanguages = jsValidatorInstance.getSupportedLanguages(); if (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) { configurations.add(new ValidatorConfiguration(jsValidator, emptyMap)); } } catch (RedPenException ignored) { } } return configurations; } }
ValidatorFactory { public static List<ValidatorConfiguration> getConfigurations(String lang) { List<ValidatorConfiguration> configurations = validators.entrySet().stream().filter(e -> { List<String> supportedLanguages = e.getValue().getSupportedLanguages(); boolean deprecated = e.getValue().getClass().getAnnotation(Deprecated.class) == null ? false : true; return (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) && !deprecated; }).map(e -> new ValidatorConfiguration(e.getKey(), toStrings(e.getValue().getProperties()))).collect(toList()); Map<String, String> emptyMap = new LinkedHashMap<>(); for (String jsValidator : jsValidators.keySet()) { try { Validator jsValidatorInstance = getInstance(jsValidator); List<String> supportedLanguages = jsValidatorInstance.getSupportedLanguages(); if (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) { configurations.add(new ValidatorConfiguration(jsValidator, emptyMap)); } } catch (RedPenException ignored) { } } return configurations; }  }
ValidatorFactory { public static List<ValidatorConfiguration> getConfigurations(String lang) { List<ValidatorConfiguration> configurations = validators.entrySet().stream().filter(e -> { List<String> supportedLanguages = e.getValue().getSupportedLanguages(); boolean deprecated = e.getValue().getClass().getAnnotation(Deprecated.class) == null ? false : true; return (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) && !deprecated; }).map(e -> new ValidatorConfiguration(e.getKey(), toStrings(e.getValue().getProperties()))).collect(toList()); Map<String, String> emptyMap = new LinkedHashMap<>(); for (String jsValidator : jsValidators.keySet()) { try { Validator jsValidatorInstance = getInstance(jsValidator); List<String> supportedLanguages = jsValidatorInstance.getSupportedLanguages(); if (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) { configurations.add(new ValidatorConfiguration(jsValidator, emptyMap)); } } catch (RedPenException ignored) { } } return configurations; }  static List<ValidatorConfiguration> getConfigurations(String lang); static Validator getInstance(String validatorName); static Validator getInstance(ValidatorConfiguration config, Configuration globalConfig); }
ValidatorFactory { public static List<ValidatorConfiguration> getConfigurations(String lang) { List<ValidatorConfiguration> configurations = validators.entrySet().stream().filter(e -> { List<String> supportedLanguages = e.getValue().getSupportedLanguages(); boolean deprecated = e.getValue().getClass().getAnnotation(Deprecated.class) == null ? false : true; return (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) && !deprecated; }).map(e -> new ValidatorConfiguration(e.getKey(), toStrings(e.getValue().getProperties()))).collect(toList()); Map<String, String> emptyMap = new LinkedHashMap<>(); for (String jsValidator : jsValidators.keySet()) { try { Validator jsValidatorInstance = getInstance(jsValidator); List<String> supportedLanguages = jsValidatorInstance.getSupportedLanguages(); if (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) { configurations.add(new ValidatorConfiguration(jsValidator, emptyMap)); } } catch (RedPenException ignored) { } } return configurations; }  static List<ValidatorConfiguration> getConfigurations(String lang); static Validator getInstance(String validatorName); static Validator getInstance(ValidatorConfiguration config, Configuration globalConfig);  }