com.puppycrawl.tools.checkstyle.checks.javadoc

Class JavadocMethodCheck

public class JavadocMethodCheck extends AbstractTypeAwareCheck

Checks the Javadoc of a method or constructor.

Version: 1.1

Author: Oliver Burn Rick Giles o_sukhodoslky

Method Summary
int[]getAcceptableTokens()
{@inheritDoc}
int[]getDefaultTokens()
{@inheritDoc}
protected booleanisMissingJavadocAllowed(DetailAST aAST)
The JavadocMethodCheck is about to report a missing Javadoc.
protected voidlogLoadError(Token aIdent)
Logs error if unable to load class information.
protected voidprocessAST(DetailAST aAST)
Checks Javadoc comments for a method or constructor.
voidsetAllowMissingJavadoc(boolean aFlag)
Controls whether to ignore errors when there is no javadoc.
voidsetAllowMissingParamTags(boolean aFlag)
controls whether to allow a method which has parameters to omit matching param tags in the javadoc.
voidsetAllowMissingPropertyJavadoc(boolean aFlag)
Controls whether to ignore errors when there is no javadoc for a property accessor (setter/getter methods).
voidsetAllowMissingReturnTag(boolean aFlag)
controls whether to allow a method which returns non-void type to omit the return tag in the javadoc.
voidsetAllowMissingThrowsTags(boolean aFlag)
controls whether to allow a method which declares that it throws exceptions to omit matching throws tags in the javadoc.
voidsetAllowThrowsTagsForSubclasses(boolean aFlag)
controls whether to allow documented exception that are subclass of one of declared exceptions.
voidsetAllowUndeclaredRTE(boolean aFlag)
controls whether to allow documented exceptions that are not declared if they are a subclass of java.lang.RuntimeException.
voidsetExcludeScope(String aScope)
Set the excludeScope.
voidsetScope(String aFrom)
Set the scope.

Method Detail

getAcceptableTokens

public int[] getAcceptableTokens()
{@inheritDoc}

getDefaultTokens

public int[] getDefaultTokens()
{@inheritDoc}

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(Token aIdent)
Logs error if unable to load class information.

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.

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