org.springframework.config.java.enhancement.cglib
Class CglibConfigurationEnhancer

java.lang.Object
  extended by org.springframework.config.java.enhancement.cglib.CglibConfigurationEnhancer
All Implemented Interfaces:
ConfigurationEnhancer

public class CglibConfigurationEnhancer
extends Object
implements ConfigurationEnhancer

ConfigurationEnhancer implementation that uses CGLIB to subclass and enhance a target Configuration class.

Author:
Rod Johnson, Costin Leau, Chris Beams

Constructor Summary
CglibConfigurationEnhancer(ConfigurableListableBeanFactory owningBeanFactory, BeanNameTrackingDefaultListableBeanFactory childFactory, BeanNamingStrategy beanNamingStrategy, List<BeanMethodReturnValueProcessor> returnValueProcessors, ValueSource valueSource)
           
 
Method Summary
<T> Class<? extends T>
enhanceConfiguration(Class<T> configurationClass)
          Return an enhanced version of the given configuration instance and class.
static void validateSuitabilityForEnhancement(Class<?> configurationClass)
          Ensures class is suitable for later enhancement, throws an exception otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CglibConfigurationEnhancer

public CglibConfigurationEnhancer(ConfigurableListableBeanFactory owningBeanFactory,
                                  BeanNameTrackingDefaultListableBeanFactory childFactory,
                                  BeanNamingStrategy beanNamingStrategy,
                                  List<BeanMethodReturnValueProcessor> returnValueProcessors,
                                  ValueSource valueSource)
Method Detail

enhanceConfiguration

public <T> Class<? extends T> enhanceConfiguration(Class<T> configurationClass)
Description copied from interface: ConfigurationEnhancer
Return an enhanced version of the given configuration instance and class.

This interface allows implementations to choose different strategies for enhancement. One option would be directly enhancing the bytecode of configurationClass while another would be to subclass it, CGLib-style. Note that depending on the underlying implementation, certain restrictions may be placed on the class definition. e.g.: a CGLib implementation would disallow final classes/methods, etc.

Specified by:
enhanceConfiguration in interface ConfigurationEnhancer
Parameters:
configurationClass - configuration class - mandatory
Returns:
the enhanced class

validateSuitabilityForEnhancement

public static void validateSuitabilityForEnhancement(Class<?> configurationClass)
Ensures class is suitable for later enhancement, throws an exception otherwise.

Parameters:
candidateConfigurationClass - class to validate
Throws:
IllegalArgumentException - if configurationClass is declared final


Copyright � 2005-2008 Spring Framework. All Rights Reserved.