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--helpargument is mentioned, no configuration is produced.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PmdParametersParseResultextractParameters(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.ParameterExceptiongetError()Returns the error if parsing failed.booleanisError()Returns true if parsing failed.booleanisHelp()Returns whether parsing just requested the--helptext.booleanisVersion()Returns whether parsing just requested the--versiontext.@Nullable PMDConfigurationtoConfiguration()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--helptext. In this case no configuration is produced.
-
isVersion
public boolean isVersion()
Returns whether parsing just requested the--versiontext. 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 @Nullable 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).- Parameters:
args- Array of parameters- Returns:
- A parse result
- Throws:
NullPointerException- If the parameter array is null
-
-