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).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.PMDConfiguration
toConfiguration()
Returns the resulting configuration if parsing succeeded and not {@link #isHelp(). Otherwise returns null.
-
-
-
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.
-
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.
-
toConfiguration
public PMDConfiguration toConfiguration()
Returns the resulting configuration if parsing succeeded and not {@link #isHelp(). 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
-
-