jfun.yan
Class FilteredPropertiesInjector

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

public class FilteredPropertiesInjector
extends java.lang.Object
implements PropertiesInjector

This implementation only attempts to inject a property when this property satisfies a MemberPredicate object.

Author:
Ben Yu Dec 31, 2005 12:51:53 PM
See Also:
Serialized Form

Constructor Summary
FilteredPropertiesInjector(BeanType btype, MemberPredicate pred)
          Create an instance of FilteredPropertiesInjector.
 
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, MemberPredicate pred)
          Create an instance of FilteredPropertiesInjector.
 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

FilteredPropertiesInjector

public FilteredPropertiesInjector(BeanType btype,
                                  MemberPredicate pred)
Create an instance of FilteredPropertiesInjector.

Parameters:
btype - the bean type. If null, dynamic binding is used.
pred - the MemberPredicate object to filter the properties.
Method Detail

instance

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

Parameters:
type - the bean class.
pred - the MemberPredicate object.
Returns:
the instance.
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