Package net.sourceforge.pmd.cli
Class PmdParametersParseResult
- java.lang.Object
-
- net.sourceforge.pmd.cli.PmdParametersParseResult
-
public final class PmdParametersParseResult extends Object
Result of parsing a bunch of CLI arguments. Parsing may fail with an exception, or succeed and produce aPMDConfiguration
. If the--help
argument is mentioned, no configuration is produced.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PmdParametersParseResult
extractParameters(String... args)
Parse an array of CLI parameters and returns a result (which may be failed).Map<String,String>
getDeprecatedOptionsUsed()
Returns a map of deprecated CLI options used by the command that created this instance.com.beust.jcommander.ParameterException
getError()
Returns the error if parsing failed.boolean
isError()
Returns true if parsing failed.boolean
isHelp()
Returns whether parsing just requested the--help
text.boolean
isVersion()
Returns whether parsing just requested the--version
text.PMDConfiguration
toConfiguration()
Returns the resulting configuration if parsing succeeded and neitherisHelp()
norisVersion()
is requested.
-
-
-
Method Detail
-
isError
public boolean isError()
Returns true if parsing failed.
-
isHelp
public boolean isHelp()
Returns whether parsing just requested the--help
text. In this case no configuration is produced.
-
isVersion
public boolean isVersion()
Returns whether parsing just requested the--version
text. In this case no configuration is produced.
-
getError
public com.beust.jcommander.ParameterException getError()
Returns the error if parsing failed. Parsing may fail if required parameters are not provided, or if some parameters don't pass validation. Otherwise returns null.
-
getDeprecatedOptionsUsed
public Map<String,String> getDeprecatedOptionsUsed()
Returns a map of deprecated CLI options used by the command that created this instance. Each key is a deprecated option that was used, and the value is a suggested replacement (a piece of English text).
-
toConfiguration
public PMDConfiguration toConfiguration()
Returns the resulting configuration if parsing succeeded and neitherisHelp()
norisVersion()
is requested. Otherwise returns null.
-
extractParameters
public static PmdParametersParseResult extractParameters(String... args)
Parse an array of CLI parameters and returns a result (which may be failed). Use this instead ofPMDCommandLineInterface.extractParameters(PMDParameters, String[], String)
, because that one may terminate the VM.- Parameters:
args
- Array of parameters- Returns:
- A parse result
- Throws:
NullPointerException
- If the parameter array is null
-
-