Class ModuleImportRule
java.lang.Object
com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportRule
com.puppycrawl.tools.checkstyle.checks.imports.ModuleImportRule
Represents whether a module is allowed to be imported or not.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionModuleImportRule(boolean allow, boolean localOnly, String moduleName, boolean regExp) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionverifyImport(String forImport) Verifies whether a module name is used.Methods inherited from class com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportRule
calculateResult, isLocalOnly, isRegExp
-
Field Details
-
moduleName
Module to control access to.
-
-
Constructor Details
-
ModuleImportRule
ModuleImportRule(boolean allow, boolean localOnly, String moduleName, boolean regExp) Constructs an instance.- Parameters:
allow- whether to allow access.localOnly- whether the rule is to be applied locally onlymoduleName- the module to apply the rule on.regExp- whether the module name is to be interpreted as a regular expression.
-
-
Method Details
-
verifyImport
Verifies whether a module name is used.- Specified by:
verifyImportin classAbstractImportRule- Parameters:
forImport- the import to check.- Returns:
- a result
AccessResultindicating whether it can be used.
-