Class ClassImportRule
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportRule
-
- com.puppycrawl.tools.checkstyle.checks.imports.ClassImportRule
-
class ClassImportRule extends AbstractImportRule
Represents whether a class is allowed to be imported or not.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
className
Package to control access to.
-
Constructor Summary
Constructors Constructor Description ClassImportRule(boolean allow, boolean localOnly, java.lang.String className, boolean regExp)
Constructs an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessResult
verifyImport(java.lang.String forImport)
Verifies whether a class name is used.-
Methods inherited from class com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportRule
calculateResult, isLocalOnly, isRegExp
-
-
-
-
Field Detail
-
className
private final java.lang.String className
Package to control access to.
-
-
Constructor Detail
-
ClassImportRule
ClassImportRule(boolean allow, boolean localOnly, java.lang.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 Detail
-
verifyImport
public AccessResult verifyImport(java.lang.String forImport)
Verifies whether a class name is used.- Specified by:
verifyImport
in classAbstractImportRule
- Parameters:
forImport
- the import to check.- Returns:
- a result
AccessResult
indicating whether it can be used.
-
-