org.springframework.jee.inject
Class Jsr250Metadata

java.lang.Object
  extended by org.springframework.jee.inject.Jsr250Metadata
All Implemented Interfaces:
Jsr250MetadataI
Direct Known Subclasses:
InterceptionMetadata, InterceptorMetadata, J2eeClientInjectionMetadata

public class Jsr250Metadata
extends Object
implements Jsr250MetadataI

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(DeploymentUnitMetadataI deploymentUnitMetadata, String name, Class<?> componentClass)
          Construct new component metadata
protected Jsr250Metadata(Jsr250Metadata other)
          Copy constructor.
 
Method Summary
 void addInjection(InjectionI<?> injection)
           
protected  void applyInjections(Object instance, List<? extends InjectionI<?>> 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<InjectionI<?>> 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(InjectionI 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(DeploymentUnitMetadataI 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()
Specified by:
getComponentName in interface Jsr250MetadataI

getComponentClass

public Class<?> getComponentClass()
Specified by:
getComponentClass in interface Jsr250MetadataI

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)
Specified by:
registerLifecycleEventCallbackMethod in interface Jsr250MetadataI

getLifecycleEventCallbackMethod

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

Specified by:
getLifecycleEventCallbackMethod in interface Jsr250MetadataI

getBeanDefinition

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

Returns:

addInjection

public void addInjection(InjectionI<?> injection)
Specified by:
addInjection in interface Jsr250MetadataI

getInjections

public List<InjectionI<?>> getInjections()
Specified by:
getInjections in interface Jsr250MetadataI

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

Specified by:
inject in interface Jsr250MetadataI
Parameters:
instance - newly instantiated bean instance. If it is null, static members will be used.

applyInjections

protected void applyInjections(Object instance,
                               List<? extends InjectionI<?>> 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(InjectionI 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)
Specified by:
invokeLifecycleMethods in interface Jsr250MetadataI

invokeLifecycleMethod

protected boolean invokeLifecycleMethod(Object bean,
                                        Method lifecyleMethod)

invokeLifecycleMethod

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

getDeploymentUnitMetadata

public DeploymentUnitMetadata getDeploymentUnitMetadata()
Specified by:
getDeploymentUnitMetadata in interface Jsr250MetadataI

refresh

public void refresh()
Specified by:
refresh in interface Jsr250MetadataI


Copyright © 2006-2008 SpringSource (formerly Interface21). All Rights Reserved.