类 InjectionMetadata
- java.lang.Object
- org.springframework.beans.factory.annotation.InjectionMetadata
public class InjectionMetadata extends Object
Internal class for managing injection metadata. Not intended for direct use in applications.Used by
AutowiredAnnotationBeanPostProcessor
,CommonAnnotationBeanPostProcessor
andPersistenceAnnotationBeanPostProcessor
.- 从以下版本开始:
- 2.5
- 作者:
- Juergen Hoeller
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
InjectionMetadata.InjectedElement
A single injected element.
字段概要
字段 修饰符和类型 字段 说明 static InjectionMetadata
EMPTY
An emptyInjectionMetadata
instance with no-op callbacks.
构造器概要
构造器 构造器 说明 InjectionMetadata(Class<?> targetClass, Collection<InjectionMetadata.InjectedElement> elements)
Create a newInjectionMetadata instance
.
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 void
checkConfigMembers(RootBeanDefinition beanDefinition)
void
clear(PropertyValues pvs)
Clear property skipping for the contained elements.static InjectionMetadata
forElements(Collection<InjectionMetadata.InjectedElement> elements, Class<?> clazz)
Return anInjectionMetadata
instance, possibly for empty elements.void
inject(Object target, String beanName, PropertyValues pvs)
protected boolean
needsRefresh(Class<?> clazz)
Determine whether this metadata instance needs to be refreshed.static boolean
needsRefresh(InjectionMetadata metadata, Class<?> clazz)
Check whether the given injection metadata needs to be refreshed.
字段详细资料
EMPTY
public static final InjectionMetadata EMPTY
An emptyInjectionMetadata
instance with no-op callbacks.- 从以下版本开始:
- 5.2
构造器详细资料
InjectionMetadata
public InjectionMetadata(Class<?> targetClass, Collection<InjectionMetadata.InjectedElement> elements)
Create a newInjectionMetadata instance
.Preferably use
forElements(java.util.Collection<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement>, java.lang.Class<?>)
for reusing theEMPTY
instance in case of no elements.- 参数:
targetClass
- the target classelements
- the associated elements to inject- 另请参阅:
forElements(java.util.Collection<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement>, java.lang.Class<?>)
方法详细资料
needsRefresh
protected boolean needsRefresh(Class<?> clazz)
Determine whether this metadata instance needs to be refreshed.- 参数:
clazz
- the current target class- 返回:
true
indicating a refresh,false
otherwise- 从以下版本开始:
- 5.2.4
checkConfigMembers
public void checkConfigMembers(RootBeanDefinition beanDefinition)
inject
public void inject(Object target, @Nullable String beanName, @Nullable PropertyValues pvs) throws Throwable
- 抛出:
Throwable
clear
public void clear(@Nullable PropertyValues pvs)
Clear property skipping for the contained elements.- 从以下版本开始:
- 3.2.13
forElements
public static InjectionMetadata forElements(Collection<InjectionMetadata.InjectedElement> elements, Class<?> clazz)
Return anInjectionMetadata
instance, possibly for empty elements.- 参数:
elements
- the elements to inject (possibly empty)clazz
- the target class- 返回:
- a new
InjectionMetadata(Class, Collection)
instance - 从以下版本开始:
- 5.2
needsRefresh
public static boolean needsRefresh(@Nullable InjectionMetadata metadata, Class<?> clazz)
Check whether the given injection metadata needs to be refreshed.- 参数:
metadata
- the existing metadata instanceclazz
- the current target class- 返回:
true
indicating a refresh,false
otherwise- 另请参阅:
needsRefresh(Class)