Class AutomaticBean
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.AutomaticBean
-
- All Implemented Interfaces:
Configurable
,Contextualizable
- Direct Known Subclasses:
AbstractViolationReporter
,BeforeExecutionExclusionFileFilter
,Checker
,DefaultLogger
,SeverityMatchFilter
,SuppressionCommentFilter
,SuppressionFilter
,SuppressionSingleFilter
,SuppressionXpathFilter
,SuppressionXpathSingleFilter
,SuppressWarningsFilter
,SuppressWithNearbyCommentFilter
,SuppressWithPlainTextCommentFilter
,XMLLogger
,XpathFileGeneratorAstFilter
,XpathFileGeneratorAuditListener
public abstract class AutomaticBean extends java.lang.Object implements Configurable, Contextualizable
A Java Bean that implements the component lifecycle interfaces by calling the bean's setters for all configuration attributes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AutomaticBean.OutputStreamOptions
Enum to specify behaviour regarding ignored modules.
-
Constructor Summary
Constructors Constructor Description AutomaticBean()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
configure(Configuration config)
Implements the Configurable interface using bean introspection.void
contextualize(Context context)
Implements the Contextualizable interface using bean introspection.protected abstract void
finishLocalSetup()
Provides a hook to finish the part of this component's setup that was not handled by the bean introspection.protected Configuration
getConfiguration()
Returns the configuration that was used to configure this component.protected void
setupChild(Configuration childConf)
Called by configure() for every child of this component's Configuration.
-
-
-
Method Detail
-
finishLocalSetup
protected abstract void finishLocalSetup() throws CheckstyleException
Provides a hook to finish the part of this component's setup that was not handled by the bean introspection.The default implementation does nothing.
- Throws:
CheckstyleException
- if there is a configuration error.
-
configure
public final void configure(Configuration config) throws CheckstyleException
Implements the Configurable interface using bean introspection.Subclasses are allowed to add behaviour. After the bean based setup has completed first the method
finishLocalSetup
is called to allow completion of the bean's local setup, after that the methodsetupChild
is called for eachchild Configuration
ofconfiguration
.- Specified by:
configure
in interfaceConfigurable
- Parameters:
config
- the configuration to use.- Throws:
CheckstyleException
- if there is a configuration error.- See Also:
Configurable
-
contextualize
public final void contextualize(Context context) throws CheckstyleException
Implements the Contextualizable interface using bean introspection.- Specified by:
contextualize
in interfaceContextualizable
- Parameters:
context
- the context.- Throws:
CheckstyleException
- if there is a contextualization error.- See Also:
Contextualizable
-
getConfiguration
protected final Configuration getConfiguration()
Returns the configuration that was used to configure this component.- Returns:
- the configuration that was used to configure this component.
-
setupChild
protected void setupChild(Configuration childConf) throws CheckstyleException
Called by configure() for every child of this component's Configuration.The default implementation throws
CheckstyleException
ifchildConf
isnull
because it doesn't support children. It must be overridden to validate and support children that are wanted.- Parameters:
childConf
- a child of this component's Configuration- Throws:
CheckstyleException
- if there is a configuration error.- See Also:
Configuration.getChildren()
-
-