Package io.micronaut.context
Class AbstractParametrizedBeanDefinition<T>
- java.lang.Object
-
- io.micronaut.context.AbstractBeanDefinition<T>
-
- io.micronaut.context.AbstractParametrizedBeanDefinition<T>
-
- Type Parameters:
T
- The Bean definition type
- All Implemented Interfaces:
EnvironmentConfigurable
,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<T>
,BeanContextConditional
,BeanDefinition<T>
,BeanFactory<T>
,BeanType<T>
,ParametrizedBeanFactory<T>
@Internal public abstract class AbstractParametrizedBeanDefinition<T> extends AbstractBeanDefinition<T> implements ParametrizedBeanFactory<T>
ABeanDefinition
that is aParametrizedBeanFactory
.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from class io.micronaut.context.AbstractBeanDefinition
executableMethodMap, fieldInjectionPoints, methodInjectionPoints, postConstructMethods, preDestroyMethods
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractParametrizedBeanDefinition(java.lang.Class<T> type, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, boolean requiresReflection, io.micronaut.core.type.Argument... arguments)
AbstractParametrizedBeanDefinition(java.lang.Class<T> producedType, java.lang.Class<?> declaringType, java.lang.String methodName, io.micronaut.core.annotation.AnnotationMetadata methodMetadata, boolean requiresReflection, io.micronaut.core.type.Argument... arguments)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
build(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, java.util.Map<java.lang.String,java.lang.Object> requiredArgumentValues)
Variation of theBeanFactory.build(BeanContext, BeanDefinition)
method that allows passing the values necessary for successful bean construction.protected abstract T
doBuild(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, java.util.Map<java.lang.String,java.lang.Object> requiredArgumentValues)
io.micronaut.core.type.Argument<?>[]
getRequiredArguments()
boolean
isEnabled(BeanContext context, BeanResolutionContext resolutionContext)
Return whether this component is enabled for the given context.-
Methods inherited from class io.micronaut.context.AbstractBeanDefinition
addExecutableMethod, addInjectionPoint, addInjectionPoint, addPostConstruct, addPreDestroy, configure, containsProperties, containsProperties, containsValueForField, containsValueForMethodArgument, equals, findBeanForConstructorArgument, findBeanForField, findBeanForMethodArgument, findMethod, findPossibleMethods, getAnnotationMetadata, getBeanForConstructorArgument, getBeanForField, getBeanForField, getBeanForMethodArgument, getBeanRegistrationForConstructorArgument, getBeanRegistrationForField, getBeanRegistrationForMethodArgument, getBeanRegistrationsForConstructorArgument, getBeanRegistrationsForField, getBeanRegistrationsForMethodArgument, getBeansOfTypeForConstructorArgument, getBeansOfTypeForConstructorArgument, getBeansOfTypeForField, getBeansOfTypeForField, getBeansOfTypeForMethodArgument, getBeansOfTypeForMethodArgument, getBeanType, getConstructor, getContainerElement, getDeclaringType, getExecutableMethods, getExposedTypes, getInjectedFields, getInjectedMethods, getName, getPostConstructMethods, getPreDestroyMethods, getProxiedBean, getRequiredComponents, getScope, getScopeName, getStreamOfTypeForField, getTypeArguments, getTypeArgumentsMap, getValueForConstructorArgument, getValueForField, getValueForMethodArgument, getValueForPath, getValueForPath, hashCode, hasPropertyExpressions, inject, inject, injectAnother, injectBean, injectBeanField, injectBeanMethod, isAbstract, isIterable, isPrimary, isProvided, postConstruct, preDestroy, resolveAnnotationMetadata, streamOfTypeForConstructorArgument, streamOfTypeForMethodArgument, toString, warn, warnMissingProperty
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, 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, 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, isEnabled
-
Methods inherited from interface io.micronaut.inject.BeanDefinition
asArgument, getDeclaredQualifier, getRequiredMethod, getTypeArguments, getTypeArguments, getTypeParameters, getTypeParameters, isCandidateBean, isProxy, isSingleton, resolveDynamicQualifier
-
Methods inherited from interface io.micronaut.inject.BeanFactory
build
-
Methods inherited from interface io.micronaut.inject.BeanType
isContainerType, requiresMethodProcessing
-
Methods inherited from interface io.micronaut.inject.ParametrizedBeanFactory
build
-
-
-
-
Constructor Detail
-
AbstractParametrizedBeanDefinition
public AbstractParametrizedBeanDefinition(java.lang.Class<T> producedType, java.lang.Class<?> declaringType, java.lang.String methodName, io.micronaut.core.annotation.AnnotationMetadata methodMetadata, boolean requiresReflection, io.micronaut.core.type.Argument... arguments)
- Parameters:
producedType
- The produced typedeclaringType
- The declaring typemethodName
- The method namemethodMetadata
- The method metadatarequiresReflection
- Whether requires refectionarguments
- The arguments
-
AbstractParametrizedBeanDefinition
protected AbstractParametrizedBeanDefinition(java.lang.Class<T> type, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, boolean requiresReflection, io.micronaut.core.type.Argument... arguments)
- Parameters:
type
- The typeannotationMetadata
- The annotation metadatarequiresReflection
- Whether requires reflectionarguments
- The arguments
-
-
Method Detail
-
getRequiredArguments
public io.micronaut.core.type.Argument<?>[] getRequiredArguments()
- Specified by:
getRequiredArguments
in interfaceParametrizedBeanFactory<T>
- Returns:
- The arguments required to construct this bean
-
build
public final T build(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, java.util.Map<java.lang.String,java.lang.Object> requiredArgumentValues) throws BeanInstantiationException
Description copied from interface:ParametrizedBeanFactory
Variation of theBeanFactory.build(BeanContext, BeanDefinition)
method that allows passing the values necessary for successful bean construction.- Specified by:
build
in interfaceParametrizedBeanFactory<T>
- Parameters:
resolutionContext
- TheBeanResolutionContext
context
- TheBeanContext
definition
- TheBeanDefinition
requiredArgumentValues
- The required arguments values. The keys should match the names of the arguments returned byParametrizedBeanFactory.getRequiredArguments()
- Returns:
- The instantiated bean
- Throws:
BeanInstantiationException
- If the bean cannot be instantiated for the arguments supplied
-
doBuild
protected abstract T doBuild(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, java.util.Map<java.lang.String,java.lang.Object> requiredArgumentValues)
- Parameters:
resolutionContext
- The resolution contextcontext
- The bean contextdefinition
- The bean definitionrequiredArgumentValues
- The required arguments- Returns:
- The built instance
-
isEnabled
public boolean isEnabled(@NonNull BeanContext context, @Nullable BeanResolutionContext resolutionContext)
Description copied from interface:BeanContextConditional
Return whether this component is enabled for the given context.- Specified by:
isEnabled
in interfaceBeanContextConditional
- Parameters:
context
- The contextresolutionContext
- The bean resolution context- Returns:
- True if it is
-
-