T
- The typepublic class BeanRegistration<T> extends java.lang.Object implements io.micronaut.core.order.Ordered, CreatedBean<T>, BeanType<T>
A bean registration is an association between a BeanDefinition
and a created bean, typically a
Singleton
.
Constructor and Description |
---|
BeanRegistration(BeanIdentifier identifier,
BeanDefinition<T> beanDefinition,
T bean) |
Modifier and Type | Method and Description |
---|---|
T |
bean() |
void |
close()
Destroy the bean entry, performing any shutdown and releasing any dependent objects.
|
BeanDefinition<T> |
definition() |
boolean |
equals(java.lang.Object o) |
T |
getBean() |
BeanDefinition<T> |
getBeanDefinition() |
java.lang.Class<T> |
getBeanType()
Returns the bean type.
|
BeanIdentifier |
getIdentifier() |
int |
getOrder() |
int |
hashCode() |
BeanIdentifier |
id()
Returns an ID that is unique to the bean and can be used to cache the instance if necessary.
|
boolean |
isEnabled(BeanContext context,
BeanResolutionContext resolutionContext)
Return whether this component is enabled for the given context.
|
static <K> BeanRegistration<K> |
of(BeanContext beanContext,
BeanIdentifier identifier,
BeanDefinition<K> beanDefinition,
K bean)
Creates new bean registration.
|
static <K> BeanRegistration<K> |
of(BeanContext beanContext,
BeanIdentifier identifier,
BeanDefinition<K> beanDefinition,
K bean,
java.util.List<BeanRegistration<?>> dependents)
Creates new bean registration.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getExposedTypes, getName, isCandidateBean, isContainerType, isPrimary, requiresMethodProcessing
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
isEnabled
public BeanRegistration(BeanIdentifier identifier, BeanDefinition<T> beanDefinition, T bean)
identifier
- The bean identifierbeanDefinition
- The bean definitionbean
- The bean instance@NonNull public static <K> BeanRegistration<K> of(@NonNull BeanContext beanContext, @NonNull BeanIdentifier identifier, @NonNull BeanDefinition<K> beanDefinition, @NonNull K bean)
K
- The bean registration typebeanContext
- The bean contextidentifier
- The bean identifierbeanDefinition
- The bean definitionbean
- The bean instance@NonNull public static <K> BeanRegistration<K> of(@NonNull BeanContext beanContext, @NonNull BeanIdentifier identifier, @NonNull BeanDefinition<K> beanDefinition, @NonNull K bean, @Nullable java.util.List<BeanRegistration<?>> dependents)
K
- The bean registration typebeanContext
- The bean contextidentifier
- The bean identifierbeanDefinition
- The bean definitionbean
- The bean instancedependents
- The dependentspublic int getOrder()
getOrder
in interface io.micronaut.core.order.Ordered
public BeanIdentifier getIdentifier()
public BeanDefinition<T> getBeanDefinition()
public T getBean()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public BeanDefinition<T> definition()
definition
in interface CreatedBean<T>
@NonNull public T bean()
bean
in interface CreatedBean<T>
public BeanIdentifier id()
CreatedBean
id
in interface CreatedBean<T>
public void close()
CreatedBean
close
in interface CreatedBean<T>
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public boolean isEnabled(BeanContext context, BeanResolutionContext resolutionContext)
BeanContextConditional
isEnabled
in interface BeanContextConditional
context
- The contextresolutionContext
- The bean resolution contextpublic java.lang.Class<T> getBeanType()
BeanType
getBeanType
in interface BeanType<T>