Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.puppycrawl.tools.checkstyle.api
Class ScopeUtils

    java.lang.Object
      com.puppycrawl.tools.checkstyle.api.ScopeUtils

    public final class ScopeUtils

extends Object

Contains utility methods for working on scope.

Version:
  1.0
Author:
  Oliver Burn

Method Summary
`static Scope` | `getScopeFromMods(DetailAST aMods)` Returns the Scope specified by the modifier set.
`static Scope` | `getSurroundingScope(DetailAST aAST)` Returns the scope of the surrounding "block".
`static boolean` | `inAnnotationBlock(DetailAST aAST)` Returns whether a node is directly contained within an annotation block.
`static boolean` | `inCodeBlock(DetailAST aAST)` Returns whether the scope of a node is restricted to a code block.
`static boolean` | `inEnumBlock(DetailAST aAST)` Returns whether a node is directly contained within an enum block.
`static boolean` | `inInterfaceBlock(DetailAST aAST)` Returns whether a node is directly contained within an interface block.
`static boolean` | `inInterfaceOrAnnotationBlock(DetailAST aAST)` Returns whether a node is directly contained within an interface or annotation block.
`static boolean` | `isLocalVariableDef(DetailAST aAST)` Determines whether a node is a local variable definition.
`static boolean` | `isOuterMostType(DetailAST aAST)` Returns whether a node is contained in the outer most type block.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getScopeFromMods

    public static Scope getScopeFromMods(DetailAST aMods)

  Returns the Scope specified by the modifier set.

  Parameters:
    `aMods` - root node of a modifier set
  Returns:
    a `Scope` value

### getSurroundingScope

    public static Scope getSurroundingScope(DetailAST aAST)

  Returns the scope of the surrounding "block".

  Parameters:
    `aAST` - the node to return the scope for
  Returns:
    the Scope of the surrounding block

### inInterfaceBlock

    public static boolean inInterfaceBlock(DetailAST aAST)

  Returns whether a node is directly contained within an interface block.

  Parameters:
    `aAST` - the node to check if directly contained within an interface block
  Returns:
    a `boolean` value

### inAnnotationBlock

    public static boolean inAnnotationBlock(DetailAST aAST)

  Returns whether a node is directly contained within an annotation block.

  Parameters:
    `aAST` - the node to check if directly contained within an annotation block
  Returns:
    a `boolean` value

### inInterfaceOrAnnotationBlock

    public static boolean inInterfaceOrAnnotationBlock(DetailAST aAST)

  Returns whether a node is directly contained within an interface or annotation block.

  Parameters:
    `aAST` - the node to check if directly contained within an interface or annotation block
  Returns:
    a `boolean` value

### inEnumBlock

    public static boolean inEnumBlock(DetailAST aAST)

  Returns whether a node is directly contained within an enum block.

  Parameters:
    `aAST` - the node to check if directly contained within an enum block
  Returns:
    a `boolean` value

### 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.

  Parameters:
    `aAST` - the node to check
  Returns:
    a `boolean` value

### isOuterMostType

    public static boolean isOuterMostType(DetailAST aAST)

  Returns whether a node is contained in the outer most type block.

  Parameters:
    `aAST` - the node to check
  Returns:
    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.

  Parameters:
    `aAST` - the node to check.
  Returns:
    whether aAST is a local variable definition.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Back to the Checkstyle Home Page
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD