com.puppycrawl.tools.checkstyle.checks.javadoc

Class JavadocMethodCheck

Implemented Interfaces:
Configurable, Contextualizable

public class JavadocMethodCheck
extends AbstractTypeAwareCheck

Checks the Javadoc of a method or constructor.
Version:
1.1
Authors:
Oliver Burn
Rick Giles
o_sukhodoslky

Nested Class Summary

Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck

AbstractTypeAwareCheck.ClassInfo, AbstractTypeAwareCheck.Token

Method Summary

int[]
getAcceptableTokens()
int[]
getDefaultTokens()
protected boolean
isMissingJavadocAllowed(DetailAST aAST)
The JavadocMethodCheck is about to report a missing Javadoc.
protected void
logLoadError(AbstractTypeAwareCheck.Token aIdent)
Logs error if unable to load class information.
protected void
processAST(DetailAST aAST)
Checks Javadoc comments for a method or constructor.
void
setAllowMissingJavadoc(boolean aFlag)
Controls whether to ignore errors when there is no javadoc.
void
setAllowMissingParamTags(boolean aFlag)
controls whether to allow a method which has parameters to omit matching param tags in the javadoc.
void
setAllowMissingPropertyJavadoc(boolean aFlag)
Controls whether to ignore errors when there is no javadoc for a property accessor (setter/getter methods).
void
setAllowMissingReturnTag(boolean aFlag)
controls whether to allow a method which returns non-void type to omit the return tag in the javadoc.
void
setAllowMissingThrowsTags(boolean aFlag)
controls whether to allow a method which declares that it throws exceptions to omit matching throws tags in the javadoc.
void
setAllowThrowsTagsForSubclasses(boolean aFlag)
controls whether to allow documented exception that are subclass of one of declared exceptions.
void
setAllowUndeclaredRTE(boolean aFlag)
controls whether to allow documented exceptions that are not declared if they are a subclass of java.lang.RuntimeException.
void
setExcludeScope(String aScope)
Set the excludeScope.
void
setScope(String aFrom)
Set the scope.

Methods inherited from class com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck

beginTree, createClassInfo, findClassAlias, getCurrentClassName, getRequiredTokens, isSubclass, isUnchecked, leaveAST, leaveToken, logLoadError, logLoadErrorImpl, processAST, resolveClass, setLogLoadErrors, setSuppressLoadErrors, tryLoadClass, visitToken

Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check

beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter

getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, log, log, setId, setSeverity

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean

configure, contextualize, finishLocalSetup, getConfiguration, setupChild

Method Details

getAcceptableTokens

public int[] getAcceptableTokens()
Overrides:
getAcceptableTokens in interface Check

getDefaultTokens

public int[] getDefaultTokens()
Overrides:
getDefaultTokens in interface Check

isMissingJavadocAllowed

protected boolean isMissingJavadocAllowed(DetailAST aAST)
The JavadocMethodCheck is about to report a missing Javadoc. This hook can be used by derived classes to allow a missing javadoc in some situations. The default implementation checks allowMissingJavadoc and allowMissingPropertyJavadoc properties, do not forget to call super.isMissingJavadocAllowed(aAST) in case you want to keep this logic.
Parameters:
aAST - the tree node for the method or constructor.
Returns:
True if this method or constructor doesn't need Javadoc.

logLoadError

protected final void logLoadError(AbstractTypeAwareCheck.Token aIdent)
Logs error if unable to load class information.
Overrides:
logLoadError in interface AbstractTypeAwareCheck
Parameters:
aIdent - class name for which we can no load class.

processAST

protected final void processAST(DetailAST aAST)
Checks Javadoc comments for a method or constructor.
Overrides:
processAST in interface AbstractTypeAwareCheck
Parameters:
aAST - the tree node for the method or constructor.

setAllowMissingJavadoc

public void setAllowMissingJavadoc(boolean aFlag)
Controls whether to ignore errors when there is no javadoc. Defaults to false.
Parameters:
aFlag - a Boolean value

setAllowMissingParamTags

public void setAllowMissingParamTags(boolean aFlag)
controls whether to allow a method which has parameters to omit matching param tags in the javadoc. Defaults to false.
Parameters:
aFlag - a Boolean value

setAllowMissingPropertyJavadoc

public void setAllowMissingPropertyJavadoc(boolean aFlag)
Controls whether to ignore errors when there is no javadoc for a property accessor (setter/getter methods). Defaults to false.
Parameters:
aFlag - a Boolean value

setAllowMissingReturnTag

public void setAllowMissingReturnTag(boolean aFlag)
controls whether to allow a method which returns non-void type to omit the return tag in the javadoc. Defaults to false.
Parameters:
aFlag - a Boolean value

setAllowMissingThrowsTags

public void setAllowMissingThrowsTags(boolean aFlag)
controls whether to allow a method which declares that it throws exceptions to omit matching throws tags in the javadoc. Defaults to false.
Parameters:
aFlag - a Boolean value

setAllowThrowsTagsForSubclasses

public void setAllowThrowsTagsForSubclasses(boolean aFlag)
controls whether to allow documented exception that are subclass of one of declared exceptions.
Parameters:
aFlag - a Boolean value

setAllowUndeclaredRTE

public void setAllowUndeclaredRTE(boolean aFlag)
controls whether to allow documented exceptions that are not declared if they are a subclass of java.lang.RuntimeException.
Parameters:
aFlag - a Boolean value

setExcludeScope

public void setExcludeScope(String aScope)
Set the excludeScope.
Parameters:
aScope - a String value

setScope

public void setScope(String aFrom)
Set the scope.
Parameters:
aFrom - a String value