Class InjectionMetadata
java.lang.Object
org.springframework.beans.factory.annotation.InjectionMetadata
Internal class for managing injection metadata.
Not intended for direct use in applications.
Used by AutowiredAnnotationBeanPostProcessor
,
CommonAnnotationBeanPostProcessor
and
PersistenceAnnotationBeanPostProcessor
.
- Since:
- 2.5
- Author:
- Juergen Hoeller
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A single injected element. -
Field Summary
Modifier and TypeFieldDescriptionstatic final InjectionMetadata
An emptyInjectionMetadata
instance with no-op callbacks. -
Constructor Summary
ConstructorDescriptionInjectionMetadata
(Class<?> targetClass, Collection<InjectionMetadata.InjectedElement> elements) Create a newInjectionMetadata instance
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.Return theelements
to inject.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.
-
Field Details
-
EMPTY
An emptyInjectionMetadata
instance with no-op callbacks.- Since:
- 5.2
-
-
Constructor Details
-
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.- Parameters:
targetClass
- the target classelements
- the associated elements to inject- See Also:
-
-
Method Details
-
getInjectedElements
Return theelements
to inject.- Returns:
- the elements to inject
-
needsRefresh
Determine whether this metadata instance needs to be refreshed.- Parameters:
clazz
- the current target class- Returns:
true
indicating a refresh,false
otherwise- Since:
- 5.2.4
-
checkConfigMembers
-
inject
public void inject(Object target, @Nullable String beanName, @Nullable PropertyValues pvs) throws Throwable - Throws:
Throwable
-
clear
Clear property skipping for the contained elements.- Since:
- 3.2.13
-
forElements
public static InjectionMetadata forElements(Collection<InjectionMetadata.InjectedElement> elements, Class<?> clazz) Return anInjectionMetadata
instance, possibly for empty elements.- Parameters:
elements
- the elements to inject (possibly empty)clazz
- the target class- Returns:
- a new
InjectionMetadata(Class, Collection)
instance - Since:
- 5.2
-
needsRefresh
Check whether the given injection metadata needs to be refreshed.- Parameters:
metadata
- the existing metadata instanceclazz
- the current target class- Returns:
true
indicating a refresh,false
otherwise- See Also:
-