net.sourceforge.pmd.lang.java.symboltable
Class ClassScope

java.lang.Object
  extended by net.sourceforge.pmd.lang.symboltable.AbstractScope
      extended by net.sourceforge.pmd.lang.java.symboltable.AbstractJavaScope
          extended by net.sourceforge.pmd.lang.java.symboltable.ClassScope
All Implemented Interfaces:
Scope

public class ClassScope
extends AbstractJavaScope

This scope represents one Java class. It can have variable declarations, method declarations and inner class declarations.


Constructor Summary
ClassScope()
          This is only for anonymous inner classes

FIXME - should have name like Foo$1, not Anonymous$1 to get this working right, the parent scope needs to be passed in when instantiating a ClassScope

ClassScope(String className)
           
 
Method Summary
 NameDeclaration addNameOccurrence(NameOccurrence occurrence)
          Adds a NameOccurrence to this scope - only call this after getting a true back from Scope.contains(NameOccurrence).
protected  NameDeclaration findVariableHere(JavaNameOccurrence occurrence)
           
 Map<ClassNameDeclaration,List<NameOccurrence>> getClassDeclarations()
           
 String getClassName()
           
 Map<MethodNameDeclaration,List<NameOccurrence>> getMethodDeclarations()
           
 Map<VariableNameDeclaration,List<NameOccurrence>> getVariableDeclarations()
           
 void setIsEnum(boolean isEnum)
           
 String toString()
           
 
Methods inherited from class net.sourceforge.pmd.lang.java.symboltable.AbstractJavaScope
addDeclaration, checkForDuplicatedNameDeclaration, contains, glomNames
 
Methods inherited from class net.sourceforge.pmd.lang.symboltable.AbstractScope
getDeclarations, getDeclarations, getEnclosingScope, getParent, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassScope

public ClassScope(String className)

ClassScope

public ClassScope()
This is only for anonymous inner classes

FIXME - should have name like Foo$1, not Anonymous$1 to get this working right, the parent scope needs to be passed in when instantiating a ClassScope

Method Detail

setIsEnum

public void setIsEnum(boolean isEnum)

getClassDeclarations

public Map<ClassNameDeclaration,List<NameOccurrence>> getClassDeclarations()

getMethodDeclarations

public Map<MethodNameDeclaration,List<NameOccurrence>> getMethodDeclarations()

getVariableDeclarations

public Map<VariableNameDeclaration,List<NameOccurrence>> getVariableDeclarations()

addNameOccurrence

public NameDeclaration addNameOccurrence(NameOccurrence occurrence)
Description copied from interface: Scope
Adds a NameOccurrence to this scope - only call this after getting a true back from Scope.contains(NameOccurrence).

Specified by:
addNameOccurrence in interface Scope
Overrides:
addNameOccurrence in class AbstractScope
Returns:
the NameDeclaration that is references by the given NameOccurrence, if the NameOccurrence could be added. Otherwise null is returned.

getClassName

public String getClassName()

findVariableHere

protected NameDeclaration findVariableHere(JavaNameOccurrence occurrence)
Specified by:
findVariableHere in class AbstractJavaScope

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002–2015 InfoEther. All rights reserved.