com.baidu.jprotobuf.pbrpc.spring.annotation
类 CommonAnnotationBeanPostProcessor

java.lang.Object
  继承者 org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter
      继承者 com.baidu.jprotobuf.pbrpc.spring.annotation.CommonAnnotationBeanPostProcessor
所有已实现的接口:
java.util.EventListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor, org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>, org.springframework.core.Ordered, org.springframework.core.PriorityOrdered

public class CommonAnnotationBeanPostProcessor
extends org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter
implements org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor, org.springframework.core.PriorityOrdered, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>

Common annotation bean post processor. it uses AnnotationParserCallback
interface to define specified Annotation then recognize the Class to do
bean define action

从以下版本开始:
2.17
作者:
xiemalin
另请参见:
AnnotationParserCallback

字段摘要
protected static org.apache.commons.logging.Log LOGGER
          log this class
 
从接口 org.springframework.core.Ordered 继承的字段
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
构造方法摘要
CommonAnnotationBeanPostProcessor()
           
 
方法摘要
 void afterPropertiesSet()
          Initialize propertyResource instance load
 void destroy()
          Invoke callback destroy method
 int getOrder()
          get order
 void onApplicationEvent(org.springframework.context.ApplicationEvent event)
          Do annotation on class type resolve action after spring container started.
protected  void parseFields(java.lang.Class<?> clazz, java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> annotions, java.util.LinkedList<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement> elements)
          To parse all field to find out annotation info
protected  void parseMethods(java.lang.Class<?> clazz, java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> annotions, java.util.LinkedList<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement> elements)
          To parse all method to find out annotation info
 java.lang.Object postProcessBeforeInitialization(java.lang.Object bean, java.lang.String beanName)
          To parse all initialized bean from spring which has target annotation matches.
 void postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition, java.lang.Class beanType, java.lang.String beanName)
          Post-process the given merged bean definition for the specified bean.
 org.springframework.beans.PropertyValues postProcessPropertyValues(org.springframework.beans.PropertyValues pvs, java.beans.PropertyDescriptor[] pds, java.lang.Object bean, java.lang.String beanName)
          Post-process the given property values before the factory applies them to the given bean.
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
          Callback that supplies the owning factory to a bean instance.
 void setCallback(AnnotationParserCallback callback)
          set callback
 void setOrder(int order)
          set order
 
从类 org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter 继承的方法
determineCandidateConstructors, getEarlyBeanReference, postProcessAfterInitialization, postProcessAfterInstantiation, postProcessBeforeInstantiation, predictBeanType
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 org.springframework.beans.factory.config.BeanPostProcessor 继承的方法
postProcessAfterInitialization
 

字段详细信息

LOGGER

protected static final org.apache.commons.logging.Log LOGGER
log this class

构造方法详细信息

CommonAnnotationBeanPostProcessor

public CommonAnnotationBeanPostProcessor()
方法详细信息

setCallback

public void setCallback(AnnotationParserCallback callback)
set callback

参数:
callback - the callback to set

setOrder

public void setOrder(int order)
set order

参数:
order - the order

getOrder

public int getOrder()
get order

指定者:
接口 org.springframework.core.Ordered 中的 getOrder
返回:
the order

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
                    throws org.springframework.beans.BeansException
Callback that supplies the owning factory to a bean instance.

Invoked after the population of normal bean properties but before an initialization callback such as InitializingBean.afterPropertiesSet() or a custom init-method.

指定者:
接口 org.springframework.beans.factory.BeanFactoryAware 中的 setBeanFactory
参数:
beanFactory - owning BeanFactory (never null). The bean can immediately call methods on the factory.
抛出:
org.springframework.beans.BeansException - in case of initialization errors
另请参见:
BeanInitializationException

postProcessBeforeInitialization

public java.lang.Object postProcessBeforeInitialization(java.lang.Object bean,
                                                        java.lang.String beanName)
                                                 throws org.springframework.beans.BeansException
To parse all initialized bean from spring which has target annotation matches.

指定者:
接口 org.springframework.beans.factory.config.BeanPostProcessor 中的 postProcessBeforeInitialization
覆盖:
类 org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter 中的 postProcessBeforeInitialization
参数:
bean - original bean initialize by spring
beanName - bean name defined in spring
返回:
wrapped object by AnnotationParserCallback
抛出:
org.springframework.beans.BeansException - in case of initialization errors

postProcessMergedBeanDefinition

public void postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition,
                                            java.lang.Class beanType,
                                            java.lang.String beanName)
Post-process the given merged bean definition for the specified bean.

指定者:
接口 org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor 中的 postProcessMergedBeanDefinition
参数:
beanDefinition - the merged bean definition for the bean
beanType - the actual type of the managed bean instance
beanName - the name of the bean

postProcessPropertyValues

public org.springframework.beans.PropertyValues postProcessPropertyValues(org.springframework.beans.PropertyValues pvs,
                                                                          java.beans.PropertyDescriptor[] pds,
                                                                          java.lang.Object bean,
                                                                          java.lang.String beanName)
                                                                   throws org.springframework.beans.BeansException
Post-process the given property values before the factory applies them to the given bean. Allows for checking whether all dependencies have been satisfied, for example based on a "Required" annotation on bean property setters.

Also allows for replacing the property values to apply, typically through creating a new MutablePropertyValues instance based on the original PropertyValues, adding or removing specific values.

指定者:
接口 org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor 中的 postProcessPropertyValues
覆盖:
类 org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter 中的 postProcessPropertyValues
参数:
pvs - the property values that the factory is about to apply (never null)
pds - the relevant property descriptors for the target bean (with ignored dependency types - which the factory handles specifically - already filtered out)
bean - the bean instance created, but whose properties have not yet been set
beanName - the name of the bean
返回:
the actual property values to apply to to the given bean (can be the passed-in PropertyValues instance), or null to skip property population
抛出:
org.springframework.beans.BeansException - in case of errors
另请参见:
MutablePropertyValues

parseMethods

protected void parseMethods(java.lang.Class<?> clazz,
                            java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> annotions,
                            java.util.LinkedList<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement> elements)
To parse all method to find out annotation info

参数:
clazz - target class
annotion - target annotation to find
elements - injected element of all methods

parseFields

protected void parseFields(java.lang.Class<?> clazz,
                           java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> annotions,
                           java.util.LinkedList<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement> elements)
To parse all field to find out annotation info

参数:
clazz - target class
annotion - target annotation to find
elements - injected element of all fields

destroy

public void destroy()
             throws java.lang.Exception
Invoke callback destroy method

指定者:
接口 org.springframework.beans.factory.DisposableBean 中的 destroy
抛出:
java.lang.Exception - in case of callback do destroy action error

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Initialize propertyResource instance load

指定者:
接口 org.springframework.beans.factory.InitializingBean 中的 afterPropertiesSet
抛出:
java.lang.Exception - in case of any error

onApplicationEvent

public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
Do annotation on class type resolve action after spring container started.

指定者:
接口 org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent> 中的 onApplicationEvent
参数:
event - spring application event


Copyright © 2015 Baidu, Inc.. All Rights Reserved.