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

Quick Search    Search Deep

com.puppycrawl.tools.checkstyle.checks
Class AbstractTypeAwareCheck  view AbstractTypeAwareCheck download AbstractTypeAwareCheck.java

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.api.AutomaticBean
      extended bycom.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
          extended bycom.puppycrawl.tools.checkstyle.api.Check
              extended bycom.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck
All Implemented Interfaces:
com.puppycrawl.tools.checkstyle.api.Configurable, com.puppycrawl.tools.checkstyle.api.Contextualizable

public abstract class AbstractTypeAwareCheck
extends com.puppycrawl.tools.checkstyle.api.Check

Abstract class that endeavours to maintain type information for the Java file being checked. It provides helper methods for performing type information functions.

Version:
1.0

Nested Class Summary
protected  class AbstractTypeAwareCheck.ClassInfo
          Contains class's FullIdent and Class object if we can load it.
 
Field Summary
private  ClassResolver mClassResolver
          ClassResolver instance for current tree.
private  java.util.Set mImports
          imports details
private  com.puppycrawl.tools.checkstyle.api.FullIdent mPackageFullIdent
          full identifier for package of the method
 
Fields inherited from class com.puppycrawl.tools.checkstyle.api.Check
 
Fields inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
 
Fields inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
 
Constructor Summary
AbstractTypeAwareCheck()
           
 
Method Summary
 void beginTree(com.puppycrawl.tools.checkstyle.api.DetailAST aRootAST)
          Called before the starting to process a tree.
private  ClassResolver getClassResolver()
           
protected  boolean isSameType(java.lang.String aFirst, java.lang.String aSecond)
          Return if two Strings represent the same type, inspecting the import statements if necessary
protected  boolean isShortName(java.lang.String aShortName, java.lang.String aFullName)
          Calculate if one type name is a shortname for another type name.
protected  boolean isSubclass(java.lang.Class aChild, java.lang.Class aParent)
          Checks if one class is subclass of another
protected  boolean isUnchecked(java.lang.Class aException)
          Is exception is unchecked (subclass of RuntimeException or Error
protected abstract  void logLoadError(com.puppycrawl.tools.checkstyle.api.FullIdent aIdent)
          Logs error if unable to load class information.
protected abstract  void processAST(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
          Called to process an AST when visiting it.
private  void processImport(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
          Collects the details of imports.
private  void processPackage(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
          Collects the details of a package.
protected  java.lang.Class resolveClass(java.lang.String aClassName)
          Attempts to resolve the Class for a specified name.
protected  java.lang.Class tryLoadClass(com.puppycrawl.tools.checkstyle.api.FullIdent aIdent)
          Tries to load class.
 void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
          Called to process a token.
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check
destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, setSeverity
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mImports

private java.util.Set mImports
imports details


mPackageFullIdent

private com.puppycrawl.tools.checkstyle.api.FullIdent mPackageFullIdent
full identifier for package of the method


mClassResolver

private ClassResolver mClassResolver
ClassResolver instance for current tree.

Constructor Detail

AbstractTypeAwareCheck

public AbstractTypeAwareCheck()
Method Detail

processAST

protected abstract void processAST(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
Called to process an AST when visiting it.


beginTree

public void beginTree(com.puppycrawl.tools.checkstyle.api.DetailAST aRootAST)
Description copied from class: com.puppycrawl.tools.checkstyle.api.Check
Called before the starting to process a tree. Ideal place to initialise information that is to be collected whilst processing a tree.


visitToken

public final void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
Description copied from class: com.puppycrawl.tools.checkstyle.api.Check
Called to process a token.


isShortName

protected boolean isShortName(java.lang.String aShortName,
                              java.lang.String aFullName)
Calculate if one type name is a shortname for another type name.


isUnchecked

protected boolean isUnchecked(java.lang.Class aException)
Is exception is unchecked (subclass of RuntimeException or Error


isSubclass

protected boolean isSubclass(java.lang.Class aChild,
                             java.lang.Class aParent)
Checks if one class is subclass of another


isSameType

protected boolean isSameType(java.lang.String aFirst,
                             java.lang.String aSecond)
Return if two Strings represent the same type, inspecting the import statements if necessary


getClassResolver

private ClassResolver getClassResolver()

resolveClass

protected final java.lang.Class resolveClass(java.lang.String aClassName)
Attempts to resolve the Class for a specified name.


tryLoadClass

protected final java.lang.Class tryLoadClass(com.puppycrawl.tools.checkstyle.api.FullIdent aIdent)
Tries to load class. Logs error if unable.


logLoadError

protected abstract void logLoadError(com.puppycrawl.tools.checkstyle.api.FullIdent aIdent)
Logs error if unable to load class information. Abstract, should be overrided in subclasses.


processPackage

private void processPackage(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
Collects the details of a package.


processImport

private void processImport(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
Collects the details of imports.