public class InjectionMetadata extends Object
Used by AutowiredAnnotationBeanPostProcessor,
CommonAnnotationBeanPostProcessor and
PersistenceAnnotationBeanPostProcessor.
| Modifier and Type | Class and Description |
|---|---|
static class |
InjectionMetadata.InjectedElement
A single injected element.
|
| Modifier and Type | Field and Description |
|---|---|
static InjectionMetadata |
EMPTY
An empty
InjectionMetadata instance with no-op callbacks. |
| Constructor and Description |
|---|
InjectionMetadata(Class<?> targetClass,
Collection<InjectionMetadata.InjectedElement> elements)
Create a new
InjectionMetadata instance. |
| Modifier and Type | Method and Description |
|---|---|
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 an
InjectionMetadata 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.
|
public static final InjectionMetadata EMPTY
InjectionMetadata instance with no-op callbacks.public InjectionMetadata(Class<?> targetClass, Collection<InjectionMetadata.InjectedElement> elements)
InjectionMetadata instance.
Preferably use forElements(java.util.Collection<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement>, java.lang.Class<?>) for reusing the EMPTY
instance in case of no elements.
targetClass - the target classelements - the associated elements to injectforElements(java.util.Collection<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement>, java.lang.Class<?>)protected boolean needsRefresh(Class<?> clazz)
clazz - the current target classtrue indicating a refresh, false otherwisepublic void checkConfigMembers(RootBeanDefinition beanDefinition)
public void inject(Object target, @Nullable String beanName, @Nullable PropertyValues pvs) throws Throwable
Throwablepublic void clear(@Nullable PropertyValues pvs)
public static InjectionMetadata forElements(Collection<InjectionMetadata.InjectedElement> elements, Class<?> clazz)
InjectionMetadata instance, possibly for empty elements.elements - the elements to inject (possibly empty)clazz - the target classInjectionMetadata(Class, Collection) instancepublic static boolean needsRefresh(@Nullable InjectionMetadata metadata, Class<?> clazz)
metadata - the existing metadata instanceclazz - the current target classtrue indicating a refresh, false otherwiseneedsRefresh(Class)