org.springframework.batch.core.scope.util
Class PlaceholderTargetSource

java.lang.Object
  extended by org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
      extended by org.springframework.aop.target.SimpleBeanTargetSource
          extended by org.springframework.batch.core.scope.util.PlaceholderTargetSource
All Implemented Interfaces:
Serializable, org.springframework.aop.TargetClassAware, org.springframework.aop.TargetSource, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean

public class PlaceholderTargetSource
extends org.springframework.aop.target.SimpleBeanTargetSource
implements org.springframework.beans.factory.InitializingBean

A TargetSource that lazily initializes its target, replacing bean definition properties dynamically if they are marked as placeholders. String values with embedded %{key} patterns will be replaced with the corresponding value from the injected context (which must also be a String). This includes dynamically locating a bean reference (e.g. ref="%{foo}"), and partial replacement of patterns (e.g. value="%{foo}-bar-%{spam}"). These replacements work for context values that are primitive (String, Long, Integer). You can also replace non-primitive values directly by making the whole bean property value into a placeholder (e.g. value="%{foo}" where foo is a property in the context).

Author:
Dave Syer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
logger
 
Constructor Summary
PlaceholderTargetSource()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  String convertToString(Object value, org.springframework.beans.TypeConverter typeConverter)
           
 Object getTarget()
           
 void setContextFactory(ContextFactory contextFactory)
          Public setter for the context factory.
 
Methods inherited from class org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
copyFrom, equals, getBeanFactory, getTargetBeanName, getTargetClass, hashCode, isStatic, releaseTarget, setBeanFactory, setTargetBeanName, setTargetClass, toString, writeReplace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlaceholderTargetSource

public PlaceholderTargetSource()
Method Detail

setContextFactory

public void setContextFactory(ContextFactory contextFactory)
Public setter for the context factory. Used to construct the context root whenever placeholders are replaced in a bean definition.

Parameters:
contextFactory - the ContextFactory

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

getTarget

public Object getTarget()
                 throws org.springframework.beans.BeansException
Specified by:
getTarget in interface org.springframework.aop.TargetSource
Overrides:
getTarget in class org.springframework.aop.target.SimpleBeanTargetSource
Throws:
org.springframework.beans.BeansException

convertToString

protected String convertToString(Object value,
                                 org.springframework.beans.TypeConverter typeConverter)
Parameters:
value -
typeConverter -
Returns:
a String representation of the input if possible


Copyright © 2013. All Rights Reserved.