com.atlassian.crowd.util
Class SpringContextInstanceFactory

java.lang.Object
  extended by com.atlassian.crowd.util.SpringContextInstanceFactory
All Implemented Interfaces:
InstanceFactory, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public class SpringContextInstanceFactory
extends Object
implements InstanceFactory, org.springframework.context.ApplicationContextAware

Implementation tied to Spring.


Constructor Summary
SpringContextInstanceFactory()
           
 
Method Summary
<T> T
getInstance(Class<T> clazz)
          Gets an instance of a class.
 Object getInstance(String className)
          Get an instance of a class.
 Object getInstance(String className, ClassLoader classLoader)
          Get an instance of a class from a specific classloader.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringContextInstanceFactory

public SpringContextInstanceFactory()
Method Detail

getInstance

public Object getInstance(String className)
                   throws ClassNotFoundException
Description copied from interface: InstanceFactory
Get an instance of a class.

Specified by:
getInstance in interface InstanceFactory
Parameters:
className - name of class.
Returns:
instance of class.
Throws:
ClassNotFoundException - if the class does not exist.

getInstance

public Object getInstance(String className,
                          ClassLoader classLoader)
                   throws ClassNotFoundException
Description copied from interface: InstanceFactory
Get an instance of a class from a specific classloader.

Specified by:
getInstance in interface InstanceFactory
Parameters:
className - name of class.
classLoader - class loader.
Returns:
instance of class.
Throws:
ClassNotFoundException - if the class does not exist.

getInstance

public <T> T getInstance(Class<T> clazz)
Description copied from interface: InstanceFactory
Gets an instance of a class.

Specified by:
getInstance in interface InstanceFactory
Type Parameters:
T - type of class.
Parameters:
clazz - class.
Returns:
instance of class.

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException


Copyright © 2013 Atlassian. All Rights Reserved.