## 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<T>, java.lang.String)`.

Author:
  Oliver Burn, Rick Giles

Constructor Summary
`AbstractOptionCheck(T aDefault, Class<T> aOptionClass)` Creates a new `AbstractOptionCheck` instance.

Method Summary
`T` `getAbstractOption()`
`void` `setOption(String aOption)` Set the option to enforce.

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
`getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, 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`

Constructor Detail

### 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.

Method Detail

### 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

Copyright © 2001-2011. All Rights Reserved.