com.puppycrawl.tools.checkstyle.checks.design

Class InterfaceIsTypeCheck

Implemented Interfaces:
Configurable, Contextualizable

public final class InterfaceIsTypeCheck
extends Check

Implements Bloch, Effective Java, Item 17 - Use Interfaces only to define types.

An interface should describe a type, it is therefore inappropriate to define an interface that does not contain any methods but only constants.

The check can be configured to also disallow marker interfaces like java.io.Serializable, that do not contain methods or constants at all.

Version:
$Revision: 1.4 $

Author:
lkuehne

Method Summary

int[]
getDefaultTokens()
int[]
getRequiredTokens()
void
setAllowMarkerInterfaces(boolean aFlag)
Controls whether marker interfaces like Serializable are allowed.
void
visitToken(DetailAST aAST)

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

getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, log, log, setSeverity

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

configure, contextualize, finishLocalSetup, getConfiguration, setupChild

Method Details

getDefaultTokens

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

See Also:
Check


getRequiredTokens

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

See Also:
Check


setAllowMarkerInterfaces

public void setAllowMarkerInterfaces(boolean aFlag)
Controls whether marker interfaces like Serializable are allowed.

Parameters:
aFlag - whether to allow marker interfaces or not


visitToken

public void visitToken(DetailAST aAST)
Overrides:
visitToken in interface Check

See Also:
Check