jfun.yan
Class DefaultPropertiesInjector

java.lang.Object
  extended by jfun.yan.DefaultPropertiesInjector
All Implemented Interfaces:
java.io.Serializable, PropertiesInjector

public class DefaultPropertiesInjector
extends java.lang.Object
implements PropertiesInjector

The default PropertiesInjector implementation that uses java.beans introspection mechanism and injects properties by property names.

Author:
Ben Yu Dec 16, 2005 1:16:32 PM
See Also:
Serialized Form

Constructor Summary
DefaultPropertiesInjector(BeanType btype, java.util.Set props)
          Create an instance of DefaultPropertiesInjector using a BeanType object.
 
Method Summary
 void injectProperties(java.lang.Object obj, Dependency dep)
          Pull property values and inject to the object.
static PropertiesInjector instance(java.lang.Class type)
          Create an instance of PropertiesInjector.
static PropertiesInjector instance(java.lang.Class type, java.util.Set props)
          Create an instance of PropertiesInjector.
 java.lang.String toString()
           
 void verifyProperties(java.lang.Class type, Dependency dep)
          Verify that all required properties are resolveable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultPropertiesInjector

public DefaultPropertiesInjector(BeanType btype,
                                 java.util.Set props)
Create an instance of DefaultPropertiesInjector using a BeanType object.

Parameters:
btype - the BeanType object.
props - the property names. Note, the constructor does not validate the property names.
Method Detail

instance

public static PropertiesInjector instance(java.lang.Class type)
                                   throws java.beans.IntrospectionException
Create an instance of PropertiesInjector. If type is null, dynamic binding will be used.

Parameters:
type - the bean class.
Returns:
the instance.
Throws:
java.beans.IntrospectionException

instance

public static PropertiesInjector instance(java.lang.Class type,
                                          java.util.Set props)
                                   throws java.beans.IntrospectionException
Create an instance of PropertiesInjector.

Parameters:
type - the bean class. null if unknown.
props - the set of properties to set. null indicates all.
Returns:
the new component that handles property setting.
Throws:
java.beans.IntrospectionException

injectProperties

public void injectProperties(java.lang.Object obj,
                             Dependency dep)
Description copied from interface: PropertiesInjector
Pull property values and inject to the object.

Specified by:
injectProperties in interface PropertiesInjector
Parameters:
obj - the object to inject properties to.
dep - the dependency to pull property values form.

verifyProperties

public void verifyProperties(java.lang.Class type,
                             Dependency dep)
Description copied from interface: PropertiesInjector
Verify that all required properties are resolveable.

Specified by:
verifyProperties in interface PropertiesInjector
Parameters:
type - the type that has the properties.
dep - the dependency to resolve properties.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object