com.puppycrawl.tools.checkstyle.api
Class ScopeUtils
java.lang.Object
com.puppycrawl.tools.checkstyle.api.ScopeUtils
public final class ScopeUtils
extends java.lang.Object
Contains utility methods for working on scope.
Version:
- Oliver Burn
getScopeFromMods
public static Scope getScopeFromMods(DetailAST aMods)
Returns the Scope specified by the modifier set.
aMods
- root node of a modifier set
- a
Scope
value
getSurroundingScope
public static Scope getSurroundingScope(DetailAST aAST)
Returns the scope of the surrounding "block".
aAST
- the node to return the scope for
- the Scope of the surrounding block
inCodeBlock
public static boolean inCodeBlock(DetailAST aAST)
Returns whether the scope of a node is restricted to a code block.
A code block is a method or constructor body, or a initialiser block.
aAST
- the node to check
- a
boolean
value
inInterfaceBlock
public static boolean inInterfaceBlock(DetailAST aAST)
Returns whether a node is directly contained within an interface block.
aAST
- the node to check if directly contained within an interface
block
- a
boolean
value
isLocalVariableDef
public static boolean isLocalVariableDef(DetailAST aAST)
Determines whether a node is a local variable definition.
I.e. if it is declared in a code block, a for initializer,
or a catch parameter.
aAST
- the node to check.
- whether aAST is a local variable definition.
isOuterMostType
public static boolean isOuterMostType(DetailAST aAST)
Returns whether a node is contained in the outer most type block.
aAST
- the node to check
- a
boolean
value