Class CompositeBeanHelper


  • public final class CompositeBeanHelper
    extends java.lang.Object
    Helper class that implements low-level Plexus configuration of composite beans.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.Object convertProperty​(java.lang.Class<?> beanType, java.lang.Class<?> rawPropertyType, java.lang.reflect.Type genericPropertyType, PlexusConfiguration configuration)  
      private static java.lang.reflect.Type expandType​(java.lang.reflect.Type type)  
      private static java.lang.reflect.Field findField​(java.lang.Class<?> beanType, java.lang.String fieldName)  
      private static java.lang.reflect.Method findMethod​(java.lang.Class<?> beanType, java.lang.reflect.Type[] paramTypeHolder, java.lang.String methodName)  
      private static java.lang.reflect.Type[] getTypeArguments​(java.lang.reflect.Type type)  
      void setDefault​(java.lang.Object bean, java.lang.Object defaultValue, PlexusConfiguration configuration)
      Calls the default "set" method on the bean; re-converts the configuration if necessary.
      private static void setField​(java.lang.Object bean, java.lang.reflect.Field field, java.lang.Object value)  
      void setProperty​(java.lang.Object bean, java.lang.String propertyName, java.lang.Class<?> valueType, PlexusConfiguration configuration)
      Sets a property in the bean; looks for public setter/adder method before checking fields.
      • Methods inherited from class java.lang.Object

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

      • setDefault

        public void setDefault​(java.lang.Object bean,
                               java.lang.Object defaultValue,
                               PlexusConfiguration configuration)
                        throws ComponentConfigurationException
        Calls the default "set" method on the bean; re-converts the configuration if necessary.
        Parameters:
        bean - The bean being configured
        defaultValue - The default value
        configuration - The configuration
        Throws:
        ComponentConfigurationException
      • setProperty

        public void setProperty​(java.lang.Object bean,
                                java.lang.String propertyName,
                                java.lang.Class<?> valueType,
                                PlexusConfiguration configuration)
                         throws ComponentConfigurationException
        Sets a property in the bean; looks for public setter/adder method before checking fields.
        Parameters:
        bean - The bean being configured
        propertyName - The property name
        valueType - The value type
        configuration - The configuration
        Throws:
        ComponentConfigurationException
      • getTypeArguments

        private static java.lang.reflect.Type[] getTypeArguments​(java.lang.reflect.Type type)
      • expandType

        private static java.lang.reflect.Type expandType​(java.lang.reflect.Type type)
      • findMethod

        private static java.lang.reflect.Method findMethod​(java.lang.Class<?> beanType,
                                                           java.lang.reflect.Type[] paramTypeHolder,
                                                           java.lang.String methodName)
      • findField

        private static java.lang.reflect.Field findField​(java.lang.Class<?> beanType,
                                                         java.lang.String fieldName)
      • setField

        private static void setField​(java.lang.Object bean,
                                     java.lang.reflect.Field field,
                                     java.lang.Object value)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception