Package io.micronaut.inject.provider
Class BeanProviderDefinition
- java.lang.Object
-
- io.micronaut.inject.provider.AbstractProviderDefinition<BeanProvider<java.lang.Object>>
-
- io.micronaut.inject.provider.BeanProviderDefinition
-
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadata
,io.micronaut.core.annotation.AnnotationMetadataDelegate
,io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,io.micronaut.core.naming.Named
,io.micronaut.core.type.ArgumentCoercible<BeanProvider<java.lang.Object>>
,BeanContextConditional
,BeanDefinition<BeanProvider<java.lang.Object>>
,BeanDefinitionReference<BeanProvider<java.lang.Object>>
,BeanFactory<BeanProvider<java.lang.Object>>
,BeanType<BeanProvider<java.lang.Object>>
@Internal public final class BeanProviderDefinition extends AbstractProviderDefinition<BeanProvider<java.lang.Object>>
Implementation forBeanProvider
bean lookups.- Since:
- 3.0.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
-
Fields inherited from interface io.micronaut.inject.BeanDefinition
NAMED_ATTRIBUTE
-
-
Constructor Summary
Constructors Constructor Description BeanProviderDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BeanProvider<java.lang.Object>
buildProvider(BeanResolutionContext resolutionContext, BeanContext context, io.micronaut.core.type.Argument<java.lang.Object> argument, Qualifier<java.lang.Object> qualifier, boolean singleton)
Builds a provider implementation.java.lang.Class<BeanProvider<java.lang.Object>>
getBeanType()
Returns the bean type.protected boolean
isAllowEmptyProviders(BeanContext context)
Return whether missing providers are allowed for this implementation.boolean
isEnabled(BeanContext context, BeanResolutionContext resolutionContext)
Return whether this component is enabled for the given context.boolean
isPresent()
-
Methods inherited from class io.micronaut.inject.provider.AbstractProviderDefinition
build, equals, getAnnotationMetadata, getBeanDefinitionName, getDeclaredQualifier, getTypeArguments, getTypeArguments, hashCode, isAbstract, isContainerType, isSingleton, load
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
getAnnotationValuesByName, getAnnotationValuesByStereotype, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
-
Methods inherited from interface io.micronaut.inject.BeanContextConditional
isEnabled
-
Methods inherited from interface io.micronaut.inject.BeanDefinition
asArgument, findMethod, findPossibleMethods, getConstructor, getContainerElement, getDeclaringType, getExecutableMethods, getInjectedFields, getInjectedMethods, getName, getPostConstructMethods, getPreDestroyMethods, getRequiredComponents, getRequiredMethod, getScope, getScopeName, getTypeArguments, getTypeParameters, getTypeParameters, inject, inject, isCandidateBean, isIterable, isProvided, isProxy, resolveDynamicQualifier
-
Methods inherited from interface io.micronaut.inject.BeanDefinitionReference
isConfigurationProperties, isContextScope, load
-
Methods inherited from interface io.micronaut.inject.BeanFactory
build
-
Methods inherited from interface io.micronaut.inject.BeanType
getExposedTypes, getName, isPrimary, requiresMethodProcessing
-
-
-
-
Method Detail
-
isEnabled
public boolean isEnabled(BeanContext context, BeanResolutionContext resolutionContext)
Description copied from interface:BeanContextConditional
Return whether this component is enabled for the given context.- Specified by:
isEnabled
in interfaceBeanContextConditional
- Overrides:
isEnabled
in classAbstractProviderDefinition<BeanProvider<java.lang.Object>>
- Parameters:
context
- The contextresolutionContext
- The bean resolution context- Returns:
- True if it is
-
getBeanType
public java.lang.Class<BeanProvider<java.lang.Object>> getBeanType()
Description copied from interface:BeanType
Returns the bean type.- Returns:
- The produced bean type
-
isPresent
public boolean isPresent()
- Specified by:
isPresent
in interfaceBeanDefinitionReference<BeanProvider<java.lang.Object>>
- Overrides:
isPresent
in classAbstractProviderDefinition<BeanProvider<java.lang.Object>>
- Returns:
- Is the underlying bean type present on the classpath
-
buildProvider
protected BeanProvider<java.lang.Object> buildProvider(@NonNull BeanResolutionContext resolutionContext, @NonNull BeanContext context, @NonNull io.micronaut.core.type.Argument<java.lang.Object> argument, @Nullable Qualifier<java.lang.Object> qualifier, boolean singleton)
Description copied from class:AbstractProviderDefinition
Builds a provider implementation.- Specified by:
buildProvider
in classAbstractProviderDefinition<BeanProvider<java.lang.Object>>
- Parameters:
resolutionContext
- The resolution contextcontext
- The contextargument
- The argumentqualifier
- The qualifiersingleton
- Whether the bean is a singleton- Returns:
- The provider
-
isAllowEmptyProviders
protected boolean isAllowEmptyProviders(BeanContext context)
Description copied from class:AbstractProviderDefinition
Return whether missing providers are allowed for this implementation. Iffalse
aNoSuchBeanException
is thrown.- Overrides:
isAllowEmptyProviders
in classAbstractProviderDefinition<BeanProvider<java.lang.Object>>
- Parameters:
context
- The context- Returns:
- Returns
true
if missing providers are allowed
-
-