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