org.apache.hivemind.service.impl
Class AutowiringImpl

java.lang.Object
  extended by org.apache.hivemind.service.impl.AutowiringImpl
All Implemented Interfaces:
Autowiring

public class AutowiringImpl
extends java.lang.Object
implements Autowiring

Implementation of Autowiring. Skips properties of primitive type and the standard java data types (String, Double etc.). Properties that are already assigned are skipped too. Delegates the autowiring to implementations of AutowiringStrategy. If errors occur they are passed to an ErrorHandler. Depending on its implementation the wiring either continues with the next property or an exception is thrown.

Author:
Achim Huegen

Constructor Summary
AutowiringImpl(RegistryInfrastructure registry, java.util.List strategyContributions, ErrorHandler errorHandler)
           
 
Method Summary
 java.lang.Object autowireProperties(java.lang.Object target)
          Autowires all writable properties of target.
 java.lang.Object autowireProperties(java.lang.Object target, java.lang.String[] propertyNames)
          Autowires the properties of target defined in propertyNames.
 java.lang.Object autowireProperties(java.lang.String strategy, java.lang.Object target)
          Autowires all writable properties of target using a certain strategy.
 java.lang.Object autowireProperties(java.lang.String strategyName, java.lang.Object target, java.lang.String[] propertyNames)
          Autowires the properties of target defined in propertyNames using a certain strategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutowiringImpl

public AutowiringImpl(RegistryInfrastructure registry,
                      java.util.List strategyContributions,
                      ErrorHandler errorHandler)
Parameters:
registry - reference to registry
strategyContributions - list with instances of AutowiringStrategyContribution
errorHandler - handler for dealing with recoverable errors.
Method Detail

autowireProperties

public java.lang.Object autowireProperties(java.lang.Object target)
Description copied from interface: Autowiring
Autowires all writable properties of target. All available strategies are tried until one strategy succeeds.

Specified by:
autowireProperties in interface Autowiring
Parameters:
target - the target object whose properties should be wired
Returns:
the wired target object
See Also:
Autowiring.autowireProperties(java.lang.Object)

autowireProperties

public java.lang.Object autowireProperties(java.lang.Object target,
                                           java.lang.String[] propertyNames)
Description copied from interface: Autowiring
Autowires the properties of target defined in propertyNames. All available strategies are tried until one strategy succeeds.

Specified by:
autowireProperties in interface Autowiring
Parameters:
target - the target object whose properties should be wired
propertyNames - the properties to wire
Returns:
the wired target object
See Also:
Autowiring.autowireProperties(java.lang.Object, java.lang.String[])

autowireProperties

public java.lang.Object autowireProperties(java.lang.String strategy,
                                           java.lang.Object target)
Description copied from interface: Autowiring
Autowires all writable properties of target using a certain strategy.

Specified by:
autowireProperties in interface Autowiring
Parameters:
strategy - name of the strategy to be used. Standard strategies are defined in AutowiringStrategy
target - the target object whose properties should be wired
Returns:
the wired target object
See Also:
Autowiring.autowireProperties(java.lang.String, java.lang.Object)

autowireProperties

public java.lang.Object autowireProperties(java.lang.String strategyName,
                                           java.lang.Object target,
                                           java.lang.String[] propertyNames)
Description copied from interface: Autowiring
Autowires the properties of target defined in propertyNames using a certain strategy.

Specified by:
autowireProperties in interface Autowiring
Parameters:
strategyName - name of the strategy to be used. Standard strategies are defined in AutowiringStrategy
target - the target object whose properties should be wired
propertyNames - the properties to wire
Returns:
the wired target object
See Also:
Autowiring.autowireProperties(java.lang.String, java.lang.Object, java.lang.String[])


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.