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 forBeanProviderbean 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 booleanisAllowEmptyProviders(BeanContext context)Return whether missing providers are allowed for this implementation.booleanisEnabled(BeanContext context, BeanResolutionContext resolutionContext)Return whether this component is enabled for the given context.booleanisPresent()-
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:BeanContextConditionalReturn whether this component is enabled for the given context.- Specified by:
isEnabledin interfaceBeanContextConditional- Overrides:
isEnabledin 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:BeanTypeReturns the bean type.- Returns:
- The produced bean type
-
isPresent
public boolean isPresent()
- Specified by:
isPresentin interfaceBeanDefinitionReference<BeanProvider<java.lang.Object>>- Overrides:
isPresentin 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:AbstractProviderDefinitionBuilds a provider implementation.- Specified by:
buildProviderin 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:AbstractProviderDefinitionReturn whether missing providers are allowed for this implementation. IffalseaNoSuchBeanExceptionis thrown.- Overrides:
isAllowEmptyProvidersin classAbstractProviderDefinition<BeanProvider<java.lang.Object>>- Parameters:
context- The context- Returns:
- Returns
trueif missing providers are allowed
-
-