public class PropertyApplicator<T> extends AbstractBehavior<T>
SetterInjector
,
which is a true Setter Injection adapter.
This adapter is mostly handy for setting various primitive properties via setters;
it is also able to set javabean properties by discovering an appropriate
PropertyEditor
and using its setAsText
method.
Note that this class doesn't cache instances. If you want caching,
use a Cached
around this one.
ComponentAdapter.NOTHING
delegate
Constructor and Description |
---|
PropertyApplicator(ComponentAdapter<T> delegate)
Construct a PropertyApplicator.
|
Modifier and Type | Method and Description |
---|---|
static Object |
convert(String typeName,
String value,
ClassLoader classLoader)
Converts a String value of a named type to an object.
|
T |
getComponentInstance(PicoContainer container,
Type into)
Get a component instance and set given property values.
|
String |
getDescriptor()
Get a string key descriptor of the component adapter for use in toString()
|
void |
setProperties(Map<String,String> properties)
Sets the bean property values that should be set upon creation.
|
void |
setProperty(String name,
String value) |
accept, changeMonitor, componentHasLifecycle, currentMonitor, dispose, dispose, findAdapterOfType, getComponentImplementation, getComponentInstance, getComponentKey, getDelegate, hasLifecycle, isLazy, isStarted, start, start, stop, stop, toString, verify
public PropertyApplicator(ComponentAdapter<T> delegate) throws PicoCompositionException
delegate
- the wrapped ComponentAdapter
PicoCompositionException
public T getComponentInstance(PicoContainer container, Type into) throws PicoCompositionException
getComponentInstance
in interface ComponentAdapter<T>
getComponentInstance
in class AbstractBehavior<T>
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.into
- the class that is about to be injected into. Use ComponentAdapter.NOTHING.class if this is not important to you.PicoCompositionException
- if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambiguous situation within the
container.PicoCompositionException
- if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambiguous situation within the
container.PicoCompositionException
- if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambiguous situation within the
container.setProperties(Map)
public String getDescriptor()
ComponentAdapter
public static Object convert(String typeName, String value, ClassLoader classLoader)
PropertyEditor
.typeName
- name of the typevalue
- its valueclassLoader
- used to load a class if typeName is "class" or "java.lang.Class" (ignored otherwise)public void setProperties(Map<String,String> properties)
properties
- bean propertiespublic void setProperty(String name, String value)
Copyright © 2003–2016 Codehaus. All rights reserved.