org.springframework.jee.inject
Class Jsr250Metadata

java.lang.Object
  extended by org.springframework.jee.inject.Jsr250Metadata
Direct Known Subclasses:
InterceptionMetadata, InterceptorMetadata

public class Jsr250Metadata
extends Object

Metadata for JEE 5 injection. Can be supplemented by component-specific metadata such as EJB metadata. Each JeeMetadata is associated with a Spring BeanDefinition and attached as a custom attribute

Author:
Rod Johnson
See Also:
BeanDefinition

Field Summary
static String KEY
           
protected  Log log
           
 
Constructor Summary
  Jsr250Metadata(DeploymentUnitMetadata deploymentUnitMetadata, String name, Class<?> componentClass)
          Construct new component metadata
protected Jsr250Metadata(Jsr250Metadata other)
          Copy constructor.
 
Method Summary
 void addInjection(Injection<?> injection)
           
protected  void applyInjections(Object instance, List<? extends Injection<?>> injections)
          Apply the given injection list into the passed object.
 AbstractBeanDefinition getBeanDefinition()
          Return the Spring singleton definition that this additional metadata relates to
protected  BeanDefinitionRegistry getBeanDefinitionRegistry()
           
 Class<?> getComponentClass()
           
 ApplicationContext getComponentContext()
           
 String getComponentName()
           
 DeploymentUnitMetadata getDeploymentUnitMetadata()
           
 List<Injection<?>> getInjections()
           
 List<Method> getLifecycleEventCallbackMethod(LifecycleEvent le)
          Null if childPostConstruct annotation not found
 Object getUniqueInstanceOfType(ListableBeanFactory lbf, Class type)
           
 void inject(Object instance)
          Perform dependency injection on the given instance and invoke the PostConstruct method if any
 void injectAndPostConstruct(Object instance)
          Perform dependency injection on the given instance and invoke the PostConstruct method if any
protected  boolean invokeLifecycleMethod(Object bean, Method lifecyleMethod)
           
 boolean invokeLifecycleMethod(Object bean, Method lifecyleMethod, Object[] args)
           
 void invokeLifecycleMethods(Object bean, LifecycleEvent le)
           
protected  void invokePostConstructAndRegisterShutdownHook(Object instance)
           
 void refresh()
           
 void registerLifecycleEventCallbackMethod(LifecycleEvent le, Method m)
           
protected  Object resolve(Injection injection)
          Resolve the given injected value Look first in the Spring singleton factory, then in JNDI name
protected  Object resolveByType(Class type)
          Subclasses that know about a context can perform special purpose injection here
 void setBeanDefinition(AbstractBeanDefinition bd)
           
 void setComponentContext(ApplicationContext beanFactoryForInstance, BeanDefinitionRegistry bdr)
           
 void setComponentContext(GenericApplicationContext gac)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY

public static final String KEY

log

protected final Log log
Constructor Detail

Jsr250Metadata

protected Jsr250Metadata(Jsr250Metadata other)
Copy constructor. Performs a shallow copy.

Parameters:
other - other metadata object to copy field state from

Jsr250Metadata

public Jsr250Metadata(DeploymentUnitMetadata deploymentUnitMetadata,
                      String name,
                      Class<?> componentClass)
Construct new component metadata

Parameters:
deploymentUnitMetadata - metadata for whole deployment. This metadata will be added to indicate the new component to be deployed
name - name of the component
componentClass - class of the component
Method Detail

getComponentName

public String getComponentName()

getComponentClass

public Class<?> getComponentClass()

setComponentContext

public void setComponentContext(ApplicationContext beanFactoryForInstance,
                                BeanDefinitionRegistry bdr)

setComponentContext

public final void setComponentContext(GenericApplicationContext gac)

setBeanDefinition

public void setBeanDefinition(AbstractBeanDefinition bd)

getBeanDefinitionRegistry

protected BeanDefinitionRegistry getBeanDefinitionRegistry()

getComponentContext

public ApplicationContext getComponentContext()

registerLifecycleEventCallbackMethod

public void registerLifecycleEventCallbackMethod(LifecycleEvent le,
                                                 Method m)

getLifecycleEventCallbackMethod

public List<Method> getLifecycleEventCallbackMethod(LifecycleEvent le)
Null if childPostConstruct annotation not found


getBeanDefinition

public AbstractBeanDefinition getBeanDefinition()
Return the Spring singleton definition that this additional metadata relates to

Returns:

addInjection

public void addInjection(Injection<?> injection)

getInjections

public List<Injection<?>> getInjections()

toString

public String toString()
Overrides:
toString in class Object

inject

public void inject(Object instance)
Perform dependency injection on the given instance and invoke the PostConstruct method if any

Parameters:
instance - newly instantiated bean instance. If it is null, static members will be used.

applyInjections

protected void applyInjections(Object instance,
                               List<? extends Injection<?>> injections)
Apply the given injection list into the passed object.

Parameters:
instance -
injections -

injectAndPostConstruct

public void injectAndPostConstruct(Object instance)
Perform dependency injection on the given instance and invoke the PostConstruct method if any

Parameters:
instance - newly instantiated singleton instance

invokePostConstructAndRegisterShutdownHook

protected void invokePostConstructAndRegisterShutdownHook(Object instance)

resolve

protected Object resolve(Injection injection)
Resolve the given injected value Look first in the Spring singleton factory, then in JNDI name

Parameters:
injection - injection metadata
Returns:
object from Spring context or JNDI

resolveByType

protected Object resolveByType(Class type)
                        throws NoSuchBeanDefinitionException
Subclasses that know about a context can perform special purpose injection here

Parameters:
type -
Returns:
Throws:
NoSuchBeanDefinitionException

getUniqueInstanceOfType

public Object getUniqueInstanceOfType(ListableBeanFactory lbf,
                                      Class type)

invokeLifecycleMethods

public void invokeLifecycleMethods(Object bean,
                                   LifecycleEvent le)

invokeLifecycleMethod

protected boolean invokeLifecycleMethod(Object bean,
                                        Method lifecyleMethod)

invokeLifecycleMethod

public boolean invokeLifecycleMethod(Object bean,
                                     Method lifecyleMethod,
                                     Object[] args)

getDeploymentUnitMetadata

public DeploymentUnitMetadata getDeploymentUnitMetadata()

refresh

public void refresh()


Copyright © 2007 Interface21. All Rights Reserved.