Package io.micronaut.context.scope
Interface CustomScope<A extends Annotation>
- Type Parameters:
A- An annotation type
- All Known Implementing Classes:
AbstractConcurrentCustomScope,RefreshScope
Represents a custom scope within the
BeanContext.- Since:
- 1.0
- Author:
- Graeme Rocher
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> Optional<BeanRegistration<T>>findBeanRegistration(BeanDefinition<T> beanDefinition) Get theBeanDefinitionfor the given bean.default <T> Optional<BeanRegistration<T>>findBeanRegistration(T bean) Get theBeanDefinitionfor the given bean.<T> TgetOrCreate(BeanCreationContext<T> creationContext) Resolve an object from the given scope.<T> Optional<T>remove(BeanIdentifier identifier) Remove a bean definition from the scope.
-
Method Details
-
annotationType
- Returns:
- The scope annotation type
-
getOrCreate
Resolve an object from the given scope.- Type Parameters:
T- The bean generic type- Parameters:
creationContext- The creation context- Returns:
- The bean instance
-
remove
Remove a bean definition from the scope.- Type Parameters:
T- The generic type- Parameters:
identifier- TheBeanIdentifier- Returns:
- An
Optionalof the instance that was destroyed if it exists
-
findBeanRegistration
Get theBeanDefinitionfor the given bean.- Type Parameters:
T- The bean generic type- Parameters:
bean- The bean- Returns:
- The bean definition if it can be resolved
-
findBeanRegistration
Get theBeanDefinitionfor the given bean.- Type Parameters:
T- The bean generic type- Parameters:
beanDefinition- The bean definition- Returns:
- The bean definition if it can be resolved
- Since:
- 3.5.0
-