T
- The typepublic class BeanRegistration<T> extends Object implements Ordered, CreatedBean<T>, BeanType<T>
A bean registration is an association between a BeanDefinition
and a created bean, typically a
Singleton
.
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
EMPTY
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(Object o) |
T |
getBean() |
BeanDefinition<T> |
getBeanDefinition() |
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,
List<BeanRegistration<?>> dependents)
Creates new bean registration.
|
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 List<BeanRegistration<?>> dependents)
K
- The bean registration typebeanContext
- The bean contextidentifier
- The bean identifierbeanDefinition
- The bean definitionbean
- The bean instancedependents
- The dependentspublic int getOrder()
public BeanIdentifier getIdentifier()
public BeanDefinition<T> getBeanDefinition()
public T getBean()
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 Closeable
close
in interface AutoCloseable
public boolean isEnabled(BeanContext context, BeanResolutionContext resolutionContext)
BeanContextConditional
isEnabled
in interface BeanContextConditional
context
- The contextresolutionContext
- The bean resolution context