org.springframework.plugin.core.support
Class AbstractTypeAwareSupport<T>

java.lang.Object
  extended by org.springframework.plugin.core.support.AbstractTypeAwareSupport<T>
All Implemented Interfaces:
EventListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
Direct Known Subclasses:
BeanListFactoryBean, PluginRegistryFactoryBean

public abstract class AbstractTypeAwareSupport<T>
extends Object
implements org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>, org.springframework.beans.factory.InitializingBean

Abstract base class to implement types that need access to all beans of a given type from the ApplicationContext.

Author:
Oliver Gierke

Constructor Summary
AbstractTypeAwareSupport()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  List<T> getBeans()
          Returns all beans from the ApplicationContext that match the given type.
 void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
           
 void setApplicationContext(org.springframework.context.ApplicationContext context)
           
 void setExclusions(Class<?>[] exclusions)
          Configures the types to be excluded from the lookup.
 void setType(Class<T> type)
          Configures the type of beans to be looked up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTypeAwareSupport

public AbstractTypeAwareSupport()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext context)
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware

setType

public void setType(Class<T> type)
Configures the type of beans to be looked up.

Parameters:
type - the type to set

setExclusions

public void setExclusions(Class<?>[] exclusions)
Configures the types to be excluded from the lookup.

Parameters:
exclusions -

getBeans

protected List<T> getBeans()
Returns all beans from the ApplicationContext that match the given type.

Returns:

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

onApplicationEvent

public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>


Copyright © 2008–2014 Pivotal, Inc.. All rights reserved.