com.puppycrawl.tools.checkstyle.checks
Class AbstractOptionCheck<T extends Enum<T>>
java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.Check
com.puppycrawl.tools.checkstyle.checks.AbstractOptionCheck<T>
- Type Parameters:
T - the type of the option.
- All Implemented Interfaces:
- Configurable, Contextualizable
- Direct Known Subclasses:
- EmptyBlockCheck, EmptyForInitializerPadCheck, EmptyForIteratorPadCheck, ImportOrderCheck, LeftCurlyCheck, MethodParamPadCheck, OperatorWrapCheck, ParenPadCheck, RightCurlyCheck, TypecastParenPadCheck
public abstract class AbstractOptionCheck<T extends Enum<T>>
- extends Check
Abstract class for checks with a parameter named option, where the
option is identified by a Enum. The logic to convert from a string
representation to the Enum is to String.trim() the string
and convert using String.toUpperCase() and then look up using
Enum.valueOf(java.lang.Class, java.lang.String).
- Author:
- Oliver Burn, Rick Giles
| 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractOptionCheck
public AbstractOptionCheck(T aDefault,
Class<T> aOptionClass)
- Creates a new
AbstractOptionCheck instance.
- Parameters:
aDefault - the default option.aOptionClass - the class for the option. Required due to a quirk
in the Java language.
setOption
public void setOption(String aOption)
throws org.apache.commons.beanutils.ConversionException
- Set the option to enforce.
- Parameters:
aOption - string to decode option from
- Throws:
org.apache.commons.beanutils.ConversionException - if unable to decode
getAbstractOption
public T getAbstractOption()
- Returns:
- the
AbstractOption set