Spring Web Services Framework

org.springframework.ws.test.support
Class MockStrategiesHelper

java.lang.Object
  extended by org.springframework.ws.test.support.MockStrategiesHelper

public class MockStrategiesHelper
extends Object

Helper class for for loading default implementations of an interface.

Since:
2.0
Author:
Arjen Poutsma

Constructor Summary
MockStrategiesHelper(ApplicationContext applicationContext)
          Creates a new instance of the MockStrategiesHelper with the given application context.
 
Method Summary
 ApplicationContext getApplicationContext()
          Returns the application context.
<T> T
getStrategy(Class<T> type)
          Returns a single strategy found in the given application context.
<T,D extends T>
T
getStrategy(Class<T> type, Class<D> defaultType)
          Returns a single strategy found in the given application context, or instantiates a default strategy if no applicable strategy was found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockStrategiesHelper

public MockStrategiesHelper(ApplicationContext applicationContext)
Creates a new instance of the MockStrategiesHelper with the given application context.

Parameters:
applicationContext - the application context
Method Detail

getApplicationContext

public ApplicationContext getApplicationContext()
Returns the application context.


getStrategy

public <T> T getStrategy(Class<T> type)
Returns a single strategy found in the given application context.

Parameters:
type - the type of bean to be found in the application context
Returns:
the bean, or null if no bean of the given type can be found
Throws:
BeanInitializationException - if there is more than 1 beans of the given type

getStrategy

public <T,D extends T> T getStrategy(Class<T> type,
                                     Class<D> defaultType)
Returns a single strategy found in the given application context, or instantiates a default strategy if no applicable strategy was found.

Parameters:
type - the type of bean to be found in the application context
defaultType - the type to instantiate and return when no bean of the specified type could be found
Returns:
the bean found in the application context, or the default type if no bean of the given type can be found
Throws:
BeanInitializationException - if there is more than 1 beans of the given type

Spring Web Services Framework

Copyright © 2005-2013 The Spring Web Services Framework. All Rights Reserved.