Package io.micronaut.inject.provider
Class AbstractProviderDefinition<T>
java.lang.Object
io.micronaut.inject.provider.AbstractProviderDefinition<T>
- Type Parameters:
T- The generic type
- All Implemented Interfaces:
AnnotationMetadata,AnnotationMetadataDelegate,AnnotationMetadataProvider,AnnotationSource,BeanInfo<T>,Named,Ordered,ArgumentCoercible<T>,BeanContextConditional,BeanDefinition<T>,BeanDefinitionReference<T>,BeanType<T>,InstantiatableBeanDefinition<T>,QualifiedBeanType<T>
- Direct Known Subclasses:
BeanProviderDefinition,JakartaProviderBeanDefinition,JavaxProviderBeanDefinition
public abstract class AbstractProviderDefinition<T>
extends Object
implements InstantiatableBeanDefinition<T>, BeanDefinitionReference<T>
Abstract bean definition for other providers to extend from.
- Since:
- 3.0.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBERFields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTYFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract TbuildProvider(@NonNull BeanResolutionContext resolutionContext, @NonNull BeanContext context, @NonNull Argument<Object> argument, @Nullable Qualifier<Object> qualifier, boolean singleton) Builds a provider implementation.booleanSupplies the metadata.Resolve the declared qualifier for this bean.If the bean itself declares any type arguments this method will return the classes that represent those types.getTypeArguments(Class<?> type) Return the type arguments for the given interface or super type for this bean.inthashCode()instantiate(BeanResolutionContext resolutionContext, BeanContext context) Builds a bean instance.final booleanprotected booleanisAllowEmptyProviders(BeanContext context) Return whether missing providers are allowed for this implementation.booleanisCandidateBean(Argument<?> beanType) Return whether this bean type is a candidate for dependency injection for the passed type.booleanbooleanChecks whether the bean type is a container type.booleanisEnabled(@NonNull BeanContext context, @Nullable BeanResolutionContext resolutionContext) Return whether this component is enabled for the given context.booleanfinal booleanload()Loads the bean definition.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresentMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, copyAnnotationMetadata, 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, getAnnotationValuesByName, getAnnotationValuesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByName, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getTargetAnnotationMetadata, 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, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface io.micronaut.inject.BeanContextConditional
isEnabledMethods inherited from interface io.micronaut.inject.BeanDefinition
asArgument, findMethod, findPossibleMethods, getBeanDescription, getBeanDescription, getBeanType, getConstructor, getContainerElement, getDeclaringType, getExecutableMethods, getGenericBeanType, getInjectedFields, getInjectedMethods, getName, getPostConstructMethods, getPreDestroyMethods, getRequiredComponents, getRequiredMethod, getScope, getScopeName, getTypeArguments, getTypeInformation, getTypeParameters, getTypeParameters, hasAnnotatedMethod, isIterable, isProxy, resolveDynamicQualifierMethods inherited from interface io.micronaut.inject.BeanDefinitionReference
isContextScope, isProxiedBean, isProxyTarget, loadMethods inherited from interface io.micronaut.inject.BeanType
getBeanName, getExposedTypes, isPrimary, requiresMethodProcessingMethods inherited from interface io.micronaut.inject.InstantiatableBeanDefinition
instantiate
-
Constructor Details
-
AbstractProviderDefinition
public AbstractProviderDefinition()
-
-
Method Details
-
isContainerType
public boolean isContainerType()Description copied from interface:BeanTypeChecks whether the bean type is a container type.- Specified by:
isContainerTypein interfaceBeanType<T>- Returns:
- Whether the type is a container type like
Iterable.
-
isCandidateBean
Description copied from interface:BeanTypeReturn whether this bean type is a candidate for dependency injection for the passed type.- Specified by:
isCandidateBeanin interfaceBeanDefinition<T>- Specified by:
isCandidateBeanin interfaceBeanType<T>- Parameters:
beanType- The bean type- Returns:
- True if it is
-
isEnabled
public boolean isEnabled(@NonNull @NonNull BeanContext context, @Nullable @Nullable BeanResolutionContext resolutionContext) 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
-
getBeanDefinitionName
- Specified by:
getBeanDefinitionNamein interfaceBeanDefinitionReference<T>- Returns:
- The class name of the backing
BeanDefinition
-
load
Description copied from interface:BeanDefinitionReferenceLoads the bean definition.- Specified by:
loadin interfaceBeanDefinitionReference<T>- Returns:
- The loaded component definition or null if it shouldn't be loaded
-
isPresent
public boolean isPresent()- Specified by:
isPresentin interfaceBeanDefinitionReference<T>- Returns:
- Is the underlying bean type present on the classpath
-
buildProvider
@NonNull protected abstract T buildProvider(@NonNull @NonNull BeanResolutionContext resolutionContext, @NonNull @NonNull BeanContext context, @NonNull @NonNull Argument<Object> argument, @Nullable @Nullable Qualifier<Object> qualifier, boolean singleton) Builds a provider implementation.- Parameters:
resolutionContext- The resolution contextcontext- The contextargument- The argumentqualifier- The qualifiersingleton- Whether the bean is a singleton- Returns:
- The provider
-
instantiate
public T instantiate(BeanResolutionContext resolutionContext, BeanContext context) throws BeanInstantiationException Description copied from interface:InstantiatableBeanDefinitionBuilds a bean instance.- Specified by:
instantiatein interfaceInstantiatableBeanDefinition<T>- Parameters:
resolutionContext- The bean resolution contextcontext- The context- Returns:
- The instance
- Throws:
BeanInstantiationException- if the instance could not be instantiated
-
isAllowEmptyProviders
Return whether missing providers are allowed for this implementation. IffalseaNoSuchBeanExceptionis thrown.- Parameters:
context- The context- Returns:
- Returns
trueif missing providers are allowed
-
isAbstract
public final boolean isAbstract()- Specified by:
isAbstractin interfaceBeanDefinition<T>- Returns:
- Whether the bean definition is abstract
-
isSingleton
public final boolean isSingleton()- Specified by:
isSingletonin interfaceBeanDefinition<T>- Specified by:
isSingletonin interfaceBeanDefinitionReference<T>- Returns:
- Whether the scope is singleton
-
isConfigurationProperties
public boolean isConfigurationProperties()- Specified by:
isConfigurationPropertiesin interfaceBeanDefinition<T>- Specified by:
isConfigurationPropertiesin interfaceBeanDefinitionReference<T>- Returns:
- Is the type configuration properties.
-
getTypeArguments
Description copied from interface:BeanDefinitionReturn the type arguments for the given interface or super type for this bean.- Specified by:
getTypeArgumentsin interfaceBeanDefinition<T>- Parameters:
type- The super class or interface type- Returns:
- The type arguments
-
getTypeArguments
Description copied from interface:BeanDefinitionIf the bean itself declares any type arguments this method will return the classes that represent those types.- Specified by:
getTypeArgumentsin interfaceBeanDefinition<T>- Returns:
- The type arguments
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProviderSupplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA.- Specified by:
getAnnotationMetadatain interfaceAnnotationMetadataProvider- Returns:
- The
AnnotationMetadata
-
getDeclaredQualifier
Description copied from interface:BeanDefinitionResolve the declared qualifier for this bean.- Specified by:
getDeclaredQualifierin interfaceBeanDefinition<T>- Specified by:
getDeclaredQualifierin interfaceQualifiedBeanType<T>- Returns:
- The qualifier or null if this isn't one
-
equals
-
hashCode
public int hashCode()
-