Class AutomaticBean

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String COMMA_SEPARATOR
      Comma separator for StringTokenizer.
      private Configuration configuration
      The configuration of this bean.
    • Constructor Summary

      Constructors 
      Constructor Description
      AutomaticBean()  
    • Method Summary

      All Methods Static Methods Instance 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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COMMA_SEPARATOR

        private static final java.lang.String COMMA_SEPARATOR
        Comma separator for StringTokenizer.
        See Also:
        Constant Field Values
      • configuration

        private Configuration configuration
        The configuration of this bean.
    • Constructor Detail

      • AutomaticBean

        public AutomaticBean()
    • Method Detail

      • createBeanUtilsBean

        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.
        Returns:
        a configured BeanUtilsBean
      • registerIntegralTypes

        private static void registerIntegralTypes​(org.apache.commons.beanutils.ConvertUtilsBean cub)
        Register basic types of JDK like boolean, int, and String to use with BeanUtils. All these types are found in the java.lang package.
        Parameters:
        cub - Instance of ConvertUtilsBean to register types with.
      • registerCustomTypes

        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. None of these types should be found in the java.lang package.
        Parameters:
        cub - Instance of ConvertUtilsBean to register types with.
      • tryCopyProperty

        private void tryCopyProperty​(java.lang.String moduleName,
                                     java.lang.String key,
                                     java.lang.Object value,
                                     boolean recheck)
                              throws CheckstyleException
        Recheck property and try to copy it.
        Parameters:
        moduleName - name of the module/class
        key - key of value
        value - value
        recheck - whether to check for property existence before copy
        Throws:
        CheckstyleException - then property defined incorrectly
      • 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.
      • finishLocalSetup

        protected 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.
      • setupChild

        protected void setupChild​(Configuration childConf)
                           throws CheckstyleException
        Called by configure() for every child of this component's Configuration.

        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.

        Parameters:
        childConf - a child of this component's Configuration
        Throws:
        CheckstyleException - if there is a configuration error.
        See Also:
        Configuration.getChildren()