Class OptionsCheckRule

  • All Implemented Interfaces:
    IRule

    public class OptionsCheckRule
    extends java.lang.Object
    implements IRule
    Check that used command line options are:
    • Not on a list of known not recommended options/values
    • Not deprecated (also check Java versions later than the one currently used)
    • Documented
    Warn for any detected options that do not fulfill these criteria.
    • Field Detail

      • ACCEPTED_OPTIONS

        private static final TypedPreference<java.lang.String> ACCEPTED_OPTIONS
      • XX_OPTION_PATTERN

        private static final java.util.regex.Pattern XX_OPTION_PATTERN
        Match group 1 will contain the option name.
      • JAVA_7_DOCUMENTED_XX

        private static final java.lang.String[] JAVA_7_DOCUMENTED_XX
      • JAVA_8_DOCUMENTED_XX

        private static final java.lang.String[] JAVA_8_DOCUMENTED_XX
    • Constructor Detail

      • OptionsCheckRule

        public OptionsCheckRule()
    • Method Detail

      • isUserAcceptedOption

        private static boolean isUserAcceptedOption​(java.lang.String option,
                                                    java.util.Set<java.lang.String> acceptedOptions)
      • extractOptionName

        private static java.lang.String extractOptionName​(java.lang.String option)
      • checkDeprecatedXX

        private static boolean checkDeprecatedXX​(java.lang.String option,
                                                 java.lang.String optionName,
                                                 JavaVersion usedVersion,
                                                 java.util.List<OptionsCheckRule.OptionWarning> deprecatedList)
      • checkDocumentedXX

        private static boolean checkDocumentedXX​(java.lang.String option,
                                                 java.lang.String optionName,
                                                 JavaVersion usedVersion,
                                                 java.util.List<java.lang.String> undocumentedList)
      • evaluate

        public java.util.concurrent.RunnableFuture<Result> evaluate​(IItemCollection items,
                                                                    IPreferenceValueProvider valueProvider)
        Description copied from interface: IRule
        Gets a future representing the result of the evaluation of this rule. Running the RunnableFuture is the responsibility of the caller of this method, not the implementation.
        Specified by:
        evaluate in interface IRule
        Parameters:
        items - items to evaluate
        valueProvider - Provider of configuration values used for evaluation. The attributes that will be asked for from the provider should be provided by IRule.getConfigurationAttributes().
        Returns:
        a RunnableFuture that when run will return the evaluation result
      • getUserAcceptedOptions

        private java.util.Set<java.lang.String> getUserAcceptedOptions​(IPreferenceValueProvider valueProvider)
      • getConfigurationAttributes

        public java.util.Collection<TypedPreference<?>> getConfigurationAttributes()
        Description copied from interface: IRule
        Gets information about which attributes may be configured during rule evaluation.
        Specified by:
        getConfigurationAttributes in interface IRule
        Returns:
        a list of configuration attributes
      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface IRule
        Returns:
        a unique id for this rule implementation
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface IRule
        Returns:
        a human readable name for this rule
      • getTopic

        public java.lang.String getTopic()
        Specified by:
        getTopic in interface IRule
        Returns:
        the topic for this rule, may be null