Class SbkUtils
java.lang.Object
io.sbk.utils.SbkUtils
Utility methods for inspecting, filtering, and merging SBK arguments.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConverts option/value argument pairs to an ordered map.static StringgetArgValue(String[] args, String argName) Finds the value following an option.static StringgetClassName(String[] args) Returns the selected storage class name.static StringgetLoggerName(String[] args) Returns the selected logger name.static booleanTests whether an argument is present.static booleanTests whether the help option is present.static booleanhasVersion(String[] args) Tests whether either version option is present.static String[]Converts ordered option/value mappings to an argument array.static String[]Merges two option/value arrays, with the second array taking precedence.static @NotNull String[]redactOptionValues(String[] args, String[] sensitiveOptions) Return a copy of command-line arguments with values belonging to sensitive options replaced by a fixed mask.static @NotNull String[]redactSensitiveOptionValues(String[] args) Return a copy of SBK arguments with values for commonly used credential options replaced by a fixed mask.static @NotNull String[]removeOptionArgs(String[] args, String[] opts) Removes each named option once while retaining other arguments.static @NotNull String[]removeOptionArgsAndValues(String[] args, String[] opts) Removes each named option and its following value once.
-
Constructor Details
-
SbkUtils
public SbkUtils()Creates an SBK argument utility.
-
-
Method Details
-
redactOptionValues
@NotNull public static @NotNull String[] redactOptionValues(String[] args, String[] sensitiveOptions) Return a copy of command-line arguments with values belonging to sensitive options replaced by a fixed mask. Both-option valueand--option=valueforms are supported, without modifying the source array.- Parameters:
args- command-line argumentssensitiveOptions- sensitive option names, with or without leading dashes- Returns:
- copied arguments with sensitive values redacted
-
redactSensitiveOptionValues
-
removeOptionArgsAndValues
-
removeOptionArgs
-
getArgValue
-
getClassName
-
getLoggerName
-
hasArg
-
hasHelp
Tests whether the help option is present.- Parameters:
args- source arguments- Returns:
truewhen help was requested
-
hasVersion
Tests whether either version option is present.- Parameters:
args- source arguments- Returns:
truewhen version information was requested
-
mapToArgs
-
argsToMap
-
mergeArgs
-