abstract class AbstractImportRule
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
allowed
Indicates whether to allow access or not.
|
private boolean |
localOnly
Indicates if the rule only applies to this package.
|
private boolean |
regExp
Indicates if the name is to be interpreted
as a regular expression.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractImportRule(boolean allow,
boolean localOnly,
boolean regExp)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
protected AccessResult |
calculateResult(boolean matched)
Returns the appropriate
AccessResult based on whether there
was a match and if the rule is to allow access. |
boolean |
isLocalOnly()
Return true if the guard is to only be applied locally or false.
|
protected boolean |
isRegExp()
Return true if the name is to be interpreted as a regular expression or false.
|
abstract AccessResult |
verifyImport(java.lang.String forImport)
Verifies whether a package name is used.
|
private final boolean allowed
private final boolean localOnly
private final boolean regExp
protected AbstractImportRule(boolean allow, boolean localOnly, boolean regExp)
allow
- whether to allow access.localOnly
- whether the rule is to be applied locally only.regExp
- whether the name is to be interpreted as a regular
expression.public abstract AccessResult verifyImport(java.lang.String forImport)
forImport
- the import to check.AccessResult
indicating whether it can be used.public boolean isLocalOnly()
protected boolean isRegExp()
protected AccessResult calculateResult(boolean matched)
AccessResult
based on whether there
was a match and if the rule is to allow access.matched
- indicates whether there was a match.AccessResult
.