public class CmdLineUtils extends Object
public static Set<CmdLineOption> determineRequired(CmdLineAction action, Set<CmdLineOption> options)
CmdLineOptions are either always
 required and are required because the given CmdLineAction was
 specified.action - The CmdLineAction which was specified.options - The CmdLineOptions in question of being required or not.Set of CmdLineOptions which are either always
         required or are required because the given CmdLineAction
         was specified.public static Set<CmdLineOption> determineRequired(CmdLineAction action, Set<CmdLineOption> options, boolean ignoreActionOption)
public static Set<CmdLineOption> determineRelevantSubOptions(CmdLineAction action, GroupCmdLineOption option)
GroupCmdLineOption's sub-options which
 affect the given CmdLineAction.action - The CmdLineAction for which given
           GroupCmdLineOption's sub-options will be determined
           relevant or notoption - The GroupCmdLineOption whose sub-options are in question
           of being relevant to the given CmdLineActionGroupCmdLineOption's sub-options who are relevant to
         given CmdLineActionpublic static Set<CmdLineOption> determineRequiredSubOptions(GroupCmdLineOption option)
GroupCmdLineOption who are
 always required.option - The GroupCmdLineOption whose sub-options are check where
           they are requiredGroupCmdLineOptionpublic static Set<CmdLineOption> determineRequiredSubOptions(CmdLineAction action, GroupCmdLineOption option)
GroupCmdLineOption who are
 either always required for become requried when given
 CmdLineAction is specified.action - The specified CmdLineActionoption - The GroupCmdLineOption whose sub-options are checked if
           they are requiredGroupCmdLineOption's required sub-optionspublic static boolean isRequired(CmdLineAction action, CmdLineOption option)
CmdLineOption is required because the
 given CmdLineAction was specified or because it is always required.action - The CmdLineAction which was specified.option - The CmdLineOption in question of being required or not.public static Set<CmdLineOption> determineOptional(CmdLineAction action, Set<CmdLineOption> options)
CmdLineOptions are optional because
 the given CmdLineAction was specified.action - The CmdLineAction which was specified.options - The CmdLineOption in question of being optional or not.Set of CmdLineOptions where are optional
         because the given CmdLineAction was specified.public static boolean isOptional(CmdLineAction action, CmdLineOption option)
CmdLineOption is optional either because
 it is always optional or because the given CmdLineAction was
 specified.action - The CmdLineAction which was specified.option - The CmdLineOption in question of being optional or not.public static boolean isStrictlyOptional(CmdLineAction action, CmdLineOption option)
CmdLineOption is optional ONLY because the
 given CmdLineAction was specified.action - The CmdLineAction which was specified.option - The CmdLineOption in question of being optional or not.public static Set<CmdLineOption> getRequiredOptions(Set<CmdLineOption> options)
CmdLineOptions which are always required regardless of
 CmdLineAction specified. NOTE: Ignores CmdLineOptions of
 type ActionCmdLineOption.options - The CmdLineOptionS to check for required
           CmdLineOptionsCmdLineOptions which will be check for always required
         CmdLineOptionspublic static Set<CmdLineOption> getRequiredOptions(Set<CmdLineOption> options, boolean ignoreActionOption)
CmdLineOptions which are always required regardless of
 CmdLineAction specified.options - The CmdLineOptionS to check for required
           CmdLineOptionsignoreActionOption - Where or not to ignore CmdLineOptions of type
           ActionCmdLineOptionCmdLineOptions which will be check for always required
         CmdLineOptionspublic static List<CmdLineOption> sortOptionsByRequiredStatus(Set<CmdLineOption> options)
CmdLineOptions by requirement levels. CmdLineOptions
 which are always required have highest sort score, followed by
 CmdLineOptions which have RequirementRules, followed by
 all others.options - The Set of CmdLineOptions to sort.CmdLineOptions sorted by requirement.public static List<CmdLineOption> sortOptions(Set<CmdLineOption> options)
CmdLineOptions by there long name.options - The CmdLineOptions to be sortedList of CmdLineOptionspublic static List<CmdLineAction> sortActions(Set<CmdLineAction> actions)
CmdLineActions by there name.actions - The CmdLineActions to be sortedList of CmdLineActionspublic static CmdLineOption getOptionByName(String optionName, Set<CmdLineOption> options)
CmdLineOption whose short name or long name equals given
 option name.optionName - The short or long name of the CmdLineOption to findoptions - The CmdLineOptions to search inCmdLineOption found or null if not found.public static CmdLineOptionInstance getOptionInstanceByName(String optionName, Set<CmdLineOptionInstance> optionInsts)
CmdLineOptionInstance whose CmdLineOption's short
 name or long name equals given option name.optionName - The short or long name of the CmdLineOptionInstance's
           CmdLineOption to findoptionInsts - The CmdLineOptionIntances to search inCmdLineOptionInstance found or null if not found.public static boolean isSubOption(CmdLineOption option, CmdLineOption subOption)
CmdLineOption is a sub-option of other given
 CmdLineOption.option - CmdLineOption which is being checked if the other given
           CmdLineOption is one of its sub-optionssubOption - The CmdLineOption which is being check if it is a
           sub-option of the other given CmdLineOptionpublic static Set<CmdLineOptionInstance> findPerformAndQuitOptions(Set<CmdLineOptionInstance> options)
CmdLineOptionInstances from
 the given Set of CmdLineOptionInstances.options - The Set of CmdLineOptionInstance who will be
           check for perform-and-quit CmdLineOptionInstancesCmdLineOptionInstances foundpublic static boolean isPerformAndQuitOption(CmdLineOption option)
CmdLineOption is a perform-and-quit type
 CmdLineOption.option - The CmdLineOption being checked if it is
           perform-and-quit type.CmdLineOption is a perform-and-quit type, false
         otherwise.public static CmdLineOptionInstance findSpecifiedOption(CmdLineOption option, Set<CmdLineOptionInstance> specifiedOptions)
option - The CmdLineOption to find.specifiedOptions - The CmdLineOptionInstance whose CmdLineOption is
           the given CmdLineOptionCmdLineOptionInstance whose
         CmdLineOption is the given CmdLineOption, or null
         if not foundpublic static Set<CmdLineOptionInstance> findAllOfSpecifiedOption(CmdLineOption option, Set<CmdLineOptionInstance> specifiedOptions)
option - The CmdLineOption to find.specifiedOptions - The CmdLineOptionInstance whose CmdLineOption is
           the given CmdLineOptionCmdLineOptionInstances whose CmdLineOption is
         the given CmdLineOptionpublic static boolean isPrintSupportedActionsOption(CmdLineOption option)
CmdLineOption is a PrintSupportedActionsOption.option - The CmdLineOption in questionCmdLineOption is a
         PrintSupportedActionsOption, false otherwisepublic static PrintSupportedActionsCmdLineOption findPrintSupportedActionsOption(Set<CmdLineOption> options)
CmdLineOption of type
 PrintSupportedActionsCmdLineOption.options - The Set of CmdLineOption to find a
           PrintSupportedActionsCmdLineOption inPrintSupportedActionsCmdLineOption, or null if
         not found.public static CmdLineOptionInstance findSpecifiedPrintSupportedActionsOption(Set<CmdLineOptionInstance> options)
options - The Set of CmdLineOptionInstance to find the
           CmdLineOptionInstance whose CmdLineOption is of
           type PrintSupportedActionsCmdLineOption inCmdLineOptionInstance whose
         CmdLineOption is of type
         PrintSupportedActionsCmdLineOption, or null if not found.IllegalArgumentException - If more than one print supported actions option is specifiedpublic static boolean isAdvancedOption(CmdLineOption option)
CmdLineOption is a AdvancedCmdLineOption.option - The CmdLineOption checked if it is a
           AdvancedCmdLineOptionCmdLineOption is a AdvancedCmdLineOption,
         false otherwisepublic static AdvancedCmdLineOption asAdvancedOption(CmdLineOption option)
CmdLineOption to a AdvancedCmdLineOption.option - The CmdLineOption to cast as a
           AdvancedCmdLineOptionCmdLineOptionpublic static boolean isSimpleOption(CmdLineOption option)
CmdLineOption is a SimpleCmdLineOption.option - The CmdLineOption checked if it is a
           SimpleCmdLineOptionCmdLineOption is a SimpleCmdLineOption,
         false otherwisepublic static SimpleCmdLineOption asSimpleOption(CmdLineOption option)
CmdLineOption to a SimpleCmdLineOption.option - The CmdLineOption to cast as a
           SimpleCmdLineOptionCmdLineOptionpublic static boolean isActionOption(CmdLineOption option)
CmdLineOption is a ActionCmdLineOption.option - CmdLineOption check if a ActionCmdLineOptionCmdLineOption is a ActionCmdLineOption,
         false otherwisepublic static ActionCmdLineOption findFirstActionOption(Set<CmdLineOption> options)
options - The Set of CmdLineOption to search through for a
           ActionCmdLineOptionActionCmdLineOption, or null if not foundpublic static List<ActionCmdLineOption> findActionOptions(Set<CmdLineOption> options)
CmdLineOptions that are ActionCmdLineOptions.options - The CmdLineOptions to look through for
           ActionCmdLineOptionsActionCmdLineOptions foundpublic static CmdLineOptionInstance findSpecifiedActionOption(Set<CmdLineOptionInstance> options)
options - The Set of CmdLineOption to search through for a
           ActionCmdLineOptionActionCmdLineOption, or null if not foundIllegalArgumentException - If more than one action option has be specifiedpublic static boolean isGroupOption(CmdLineOption option)
CmdLineOption is a GroupCmdLineOption.option - CmdLineOption in questionCmdLineOption is a GroupCmdLineOption,
         false otherwisepublic static GroupCmdLineOption asGroupOption(CmdLineOption option)
CmdLineOption to a GroupCmdLineOption.option - The CmdLineOption to be cast as a
           GroupCmdLineOptionGroupCmdLineOptionpublic static boolean isHelpOption(CmdLineOption option)
CmdLineOption is a HelpCmdLineOption.option - The CmdLineOption that is checked if it is a
           HelpCmdLineOptionCmdLineOption is a HelpCmdLineOption,
         otherwise falsepublic static HelpCmdLineOption asHelpOption(CmdLineOption option)
CmdLineOption to a HelpCmdLineOption.option - The CmdLineOption to be cast as a
           HelpCmdLineOptionHelpCmdLineOptionpublic static HelpCmdLineOption findHelpOption(Set<CmdLineOption> options)
options - The Set of CmdLineOptions to search through for
           HelpCmdLineOptionHelpCmdLineOption, null if not foundpublic static CmdLineOptionInstance findSpecifiedHelpOption(Set<CmdLineOptionInstance> options)
options - The Set of CmdLineOptionInstances to search
           through for the CmdLineOptionInstance whose
           CmdLineOption is of type HelpCmdLineOptionCmdLineOptionInstance, null if not foundIllegalArgumentException - If more than one help option is specifiedpublic static CmdLineAction findAction(CmdLineOptionInstance actionOption, Set<CmdLineAction> supportedActions)
CmdLineAction specified by the given
 CmdLineOptionInstance.actionOption - The CmdLineOptionInstance which specifies an
           ActionCmdLineOptionsupportedActions - Set of supported CmdLineActionsCmdLineAction, null if not foundpublic static CmdLineAction findAction(String actionName, Set<CmdLineAction> supportedActions)
CmdLineAction by its name.actionName - Name of CmdLineAction to findsupportedActions - Set of supported CmdLineActionsCmdLineAction or null if not foundpublic static List<CmdLineOptionValidator.Result> validate(CmdLineOptionInstance option)
CmdLineOptionInstance.option - The CmdLineOptionInstance to be validatedCmdLineOptionValidator.Results from running
         CmdLineOptionValidators.public static List<CmdLineOptionValidator.Result> determineFailedValidation(List<CmdLineOptionValidator.Result> results)
CmdLineOptionValidator.Results with grade of FAIL.results - The CmdLineOptionValidator.Results which are checked if
           they have a failing grade.CmdLineOptionValidator.Results with grade of FAIL.public static void handlePerformAndQuitOption(CmdLineOptionInstance option)
CmdLineOptionInstance's handler if it a perform and
 quit option.option - The CmdLineOptionInstance whose handler will be runpublic static void handle(CmdLineAction action, CmdLineOptionInstance option)
CmdLineOptionInstance's handler against the given
 CmdLineAction.action - The CmdLineAction which the given
           CmdLineOptionInstance's handler will be run againstoption - The CmdLineOptionInstance whose handler will be run
           against the given CmdLineActionpublic static String getFormattedString(String string, int startIndex, int endIndex)
public static List<?> convertToType(List<String> values, Class<?> type) throws MalformedURLException, ClassNotFoundException, InstantiationException, IllegalAccessException
Copyright © 1999–2017 Apache OODT. All rights reserved.