public class AutomaticBean extends java.lang.Object implements Configurable, Contextualizable
Modifier and Type | Class and Description |
---|---|
private static class |
AutomaticBean.PatternConverter
A converter that converts strings to patterns.
|
private static class |
AutomaticBean.RelaxedAccessModifierArrayConverter
A converter that converts strings to
AccessModifier . |
private static class |
AutomaticBean.RelaxedStringArrayConverter
A converter that does not care whether the array elements contain String
characters like '*' or '_'.
|
private static class |
AutomaticBean.ScopeConverter
A converter that converts strings to scope.
|
private static class |
AutomaticBean.SeverityLevelConverter
A converter that converts strings to severity level.
|
private static class |
AutomaticBean.UriConverter
A converter that converts strings to uri.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
COMMA_SEPARATOR
Comma separator for StringTokenizer.
|
private Configuration |
configuration
The configuration of this bean.
|
Constructor and Description |
---|
AutomaticBean() |
Modifier and Type | Method and Description |
---|---|
void |
configure(Configuration config)
Implements the Configurable interface using bean introspection.
|
void |
contextualize(Context context)
Implements the Contextualizable interface using bean introspection.
|
private static org.apache.commons.beanutils.BeanUtilsBean |
createBeanUtilsBean()
Creates a BeanUtilsBean that is configured to use
type converters that throw a ConversionException
instead of using the default value when something
goes wrong.
|
protected 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.
|
private static void |
registerCustomTypes(org.apache.commons.beanutils.ConvertUtilsBean cub)
Register custom types of JDK like URI and Checkstyle specific classes to use with BeanUtils.
|
private static void |
registerIntegralTypes(org.apache.commons.beanutils.ConvertUtilsBean cub)
Register basic types of JDK like boolean, int, and String to use with BeanUtils.
|
protected void |
setupChild(Configuration childConf)
Called by configure() for every child of this component's Configuration.
|
private void |
tryCopyProperty(java.lang.String moduleName,
java.lang.String key,
java.lang.Object value,
boolean recheck)
Recheck property and try to copy it.
|
private static final java.lang.String COMMA_SEPARATOR
private Configuration configuration
private static org.apache.commons.beanutils.BeanUtilsBean createBeanUtilsBean()
private static void registerIntegralTypes(org.apache.commons.beanutils.ConvertUtilsBean cub)
java.lang
package.cub
- Instance of ConvertUtilsBean
to register types with.private static void registerCustomTypes(org.apache.commons.beanutils.ConvertUtilsBean cub)
java.lang
package.cub
- Instance of ConvertUtilsBean
to register types with.public final void configure(Configuration config) throws CheckstyleException
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 method setupChild
is called for each child Configuration
of configuration
.
configure
in interface Configurable
config
- the configuration to use.CheckstyleException
- if there is a configuration error.Configurable
private void tryCopyProperty(java.lang.String moduleName, java.lang.String key, java.lang.Object value, boolean recheck) throws CheckstyleException
moduleName
- name of the module/classkey
- key of valuevalue
- valuerecheck
- whether to check for property existence before copyCheckstyleException
- then property defined incorrectlypublic final void contextualize(Context context) throws CheckstyleException
contextualize
in interface Contextualizable
context
- the context.CheckstyleException
- if there is a contextualization error.Contextualizable
protected final Configuration getConfiguration()
protected void finishLocalSetup() throws CheckstyleException
The default implementation does nothing.
CheckstyleException
- if there is a configuration error.protected void setupChild(Configuration childConf) throws CheckstyleException
The default implementation throws CheckstyleException
if
childConf
is null
because it doesn't support children. It
must be overridden to validate and support children that are wanted.
childConf
- a child of this component's ConfigurationCheckstyleException
- if there is a configuration error.Configuration.getChildren()