Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.puppycrawl.tools.checkstyle.bcel
Class ReferenceVisitor  view ReferenceVisitor download ReferenceVisitor.java

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.bcel.EmptyDeepVisitor
      extended bycom.puppycrawl.tools.checkstyle.bcel.ReferenceVisitor
All Implemented Interfaces:
IDeepVisitor, IObjectSetVisitor

public final class ReferenceVisitor
extends EmptyDeepVisitor

Records references during a deep parse tree traversal.


Nested Class Summary
private  class ReferenceVisitor.GenericVisitor
          Adds a reference when it visits an instruction that invokes a method or references a field.
 
Field Summary
private  org.apache.bcel.generic.ConstantPoolGen mCurrentPoolGen
          access to current constant pool
private  java.util.Set mFieldScopes
          scope for checking field references
private  java.util.Set mMethodScopes
          scope for checking method references
private  com.puppycrawl.tools.checkstyle.bcel.classfile.ReferenceDAO mReferenceDAO
          maps a JavaClass to a JavaClassDefinition
private static ReferenceVisitor sInstance
          singleton
 
Fields inherited from class com.puppycrawl.tools.checkstyle.bcel.EmptyDeepVisitor
 
Constructor Summary
private ReferenceVisitor()
          prevent client construction
 
Method Summary
private  void addFieldReference(com.puppycrawl.tools.checkstyle.bcel.generic.FieldReference aReference)
          Adds an field reference to the reference DAO.
 void addFieldScope(com.puppycrawl.tools.checkstyle.api.Scope aScope)
          Includes a scope in the scope for checking field references.
private  void addInvokeReference(com.puppycrawl.tools.checkstyle.bcel.generic.InvokeReference aReference)
          Adds an invoke reference to the reference DAO.
 void addMethodScope(com.puppycrawl.tools.checkstyle.api.Scope aScope)
          Includes a scope in the scope for checking method references.
 com.puppycrawl.tools.checkstyle.bcel.classfile.JavaClassDefinition findJavaClassDef(org.apache.bcel.classfile.JavaClass aJavaClass)
          Finds the JavaClassDefinition for a given JavaClass.
static ReferenceVisitor getInstance()
          Returns the singleton ReferencesVisitor
 com.puppycrawl.tools.checkstyle.bcel.classfile.ReferenceDAO getReferenceDAO()
          Gets the reference DAO.
 void visitObject(java.lang.Object aObject)
          Visit an object.
 void visitSet(java.util.Set aJavaClasses)
          Visit a set itself.
 
Methods inherited from class com.puppycrawl.tools.checkstyle.bcel.EmptyDeepVisitor
getClassFileVisitor, getGenericVisitor, leaveObject, leaveSet, setClassFileVisitor, setGenericVisitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sInstance

private static ReferenceVisitor sInstance
singleton


mFieldScopes

private java.util.Set mFieldScopes
scope for checking field references


mMethodScopes

private java.util.Set mMethodScopes
scope for checking method references


mReferenceDAO

private com.puppycrawl.tools.checkstyle.bcel.classfile.ReferenceDAO mReferenceDAO
maps a JavaClass to a JavaClassDefinition


mCurrentPoolGen

private org.apache.bcel.generic.ConstantPoolGen mCurrentPoolGen
access to current constant pool

Constructor Detail

ReferenceVisitor

private ReferenceVisitor()
prevent client construction

Method Detail

getInstance

public static ReferenceVisitor getInstance()
Returns the singleton ReferencesVisitor


addInvokeReference

private void addInvokeReference(com.puppycrawl.tools.checkstyle.bcel.generic.InvokeReference aReference)
Adds an invoke reference to the reference DAO.


addFieldReference

private void addFieldReference(com.puppycrawl.tools.checkstyle.bcel.generic.FieldReference aReference)
Adds an field reference to the reference DAO.


visitSet

public void visitSet(java.util.Set aJavaClasses)
Description copied from interface: IObjectSetVisitor
Visit a set itself.

Specified by:
visitSet in interface IObjectSetVisitor
Overrides:
visitSet in class EmptyDeepVisitor

getReferenceDAO

public com.puppycrawl.tools.checkstyle.bcel.classfile.ReferenceDAO getReferenceDAO()
Gets the reference DAO.


visitObject

public void visitObject(java.lang.Object aObject)
Description copied from interface: IObjectSetVisitor
Visit an object. Normally this is an object of the set.

Specified by:
visitObject in interface IObjectSetVisitor
Overrides:
visitObject in class EmptyDeepVisitor

findJavaClassDef

public com.puppycrawl.tools.checkstyle.bcel.classfile.JavaClassDefinition findJavaClassDef(org.apache.bcel.classfile.JavaClass aJavaClass)
Finds the JavaClassDefinition for a given JavaClass.


addFieldScope

public void addFieldScope(com.puppycrawl.tools.checkstyle.api.Scope aScope)
Includes a scope in the scope for checking field references.


addMethodScope

public void addMethodScope(com.puppycrawl.tools.checkstyle.api.Scope aScope)
Includes a scope in the scope for checking method references.