Package io.micronaut.context
Class BeanRegistration<T>
java.lang.Object
io.micronaut.context.BeanRegistration<T>
- Type Parameters:
T- The type
- All Implemented Interfaces:
CreatedBean<T>,AnnotationMetadataProvider,AnnotationSource,BeanInfo<T>,Ordered,ArgumentCoercible<T>,BeanContextConditional,BeanType<T>,Closeable,AutoCloseable
A bean registration is an association between a BeanDefinition and a created bean, typically a
Singleton.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTYFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionBeanRegistration(BeanIdentifier identifier, BeanDefinition<T> beanDefinition, T bean) -
Method Summary
Modifier and TypeMethodDescriptionbean()voidclose()Destroy the bean entry, performing any shutdown and releasing any dependent objects.booleangetBean()Returns the bean type.intgetOrder()inthashCode()id()Returns an ID that is unique to the bean and can be used to cache the instance if necessary.booleanisEnabled(BeanContext context, BeanResolutionContext resolutionContext) Return whether this component is enabled for the given context.static <K> @NonNull BeanRegistration<K>of(@NonNull BeanContext beanContext, @NonNull BeanIdentifier identifier, @NonNull BeanDefinition<K> beanDefinition, K bean) Creates new bean registration.static <K> @NonNull BeanRegistration<K>of(@NonNull BeanContext beanContext, @NonNull BeanIdentifier identifier, @NonNull BeanDefinition<K> beanDefinition, K bean, @Nullable List<BeanRegistration<?>> dependents) Creates new bean registration.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclaredMethods inherited from interface io.micronaut.inject.BeanContextConditional
isEnabledMethods inherited from interface io.micronaut.core.beans.BeanInfo
asArgument, getGenericBeanTypeMethods inherited from interface io.micronaut.inject.BeanType
getBeanName, getExposedTypes, getName, isCandidateBean, isContainerType, isPrimary, requiresMethodProcessing
-
Constructor Details
-
BeanRegistration
- Parameters:
identifier- The bean identifierbeanDefinition- The bean definitionbean- The bean instance
-
-
Method Details
-
of
@NonNull public static <K> @NonNull BeanRegistration<K> of(@NonNull @NonNull BeanContext beanContext, @NonNull @NonNull BeanIdentifier identifier, @NonNull @NonNull BeanDefinition<K> beanDefinition, @NonNull K bean) Creates new bean registration. Possibly disposing registration can be returned.- Type Parameters:
K- The bean registration type- Parameters:
beanContext- The bean contextidentifier- The bean identifierbeanDefinition- The bean definitionbean- The bean instance- Returns:
- new bean registration
- Since:
- 3.5.0
-
of
@NonNull public static <K> @NonNull BeanRegistration<K> of(@NonNull @NonNull BeanContext beanContext, @NonNull @NonNull BeanIdentifier identifier, @NonNull @NonNull BeanDefinition<K> beanDefinition, @NonNull K bean, @Nullable @Nullable List<BeanRegistration<?>> dependents) Creates new bean registration. Possibly disposing registration can be returned.- Type Parameters:
K- The bean registration type- Parameters:
beanContext- The bean contextidentifier- The bean identifierbeanDefinition- The bean definitionbean- The bean instancedependents- The dependents- Returns:
- new bean registration
- Since:
- 3.5.0
-
getOrder
public int getOrder() -
getIdentifier
- Returns:
- Teh bean identifier
-
getBeanDefinition
- Returns:
- The bean definition
-
getBean
- Returns:
- The bean instance
-
toString
-
equals
-
hashCode
public int hashCode() -
definition
- Specified by:
definitionin interfaceCreatedBean<T>- Returns:
- The bean definition.
-
bean
- Specified by:
beanin interfaceCreatedBean<T>- Returns:
- The bean
-
id
Description copied from interface:CreatedBeanReturns an ID that is unique to the bean and can be used to cache the instance if necessary.- Specified by:
idin interfaceCreatedBean<T>- Returns:
- The id
-
close
public void close()Description copied from interface:CreatedBeanDestroy the bean entry, performing any shutdown and releasing any dependent objects.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCreatedBean<T>
-
isEnabled
Description copied from interface:BeanContextConditionalReturn whether this component is enabled for the given context.- Specified by:
isEnabledin interfaceBeanContextConditional- Parameters:
context- The contextresolutionContext- The bean resolution context- Returns:
- True if it is
-
getBeanType
Description copied from interface:BeanTypeReturns the bean type.- Specified by:
getBeanTypein interfaceBeanInfo<T>- Specified by:
getBeanTypein interfaceBeanType<T>- Returns:
- The underlying bean type
-