T
- The Bean definition type@Internal public class AbstractInitializableBeanDefinition<T> extends Object implements BeanDefinition<T>, EnvironmentConfigurable
Default implementation of the BeanDefinition
interface. This class is generally not used directly in user
code.
Instead a build time tool does analysis of source code and dynamically produces subclasses of this class containing
information about the available injection points for a given class.
For technical reasons the class has to be marked as public, but is regarded as internal and should be used by compiler tools and plugins (such as AST transformation frameworks)
The BeanDefinitionWriter
class can be used to produce bean definitions at
compile or runtime
BeanDefinitionWriter
Modifier and Type | Class and Description |
---|---|
static class |
AbstractInitializableBeanDefinition.AnnotationReference
The data class containing annotation injection information.
|
static class |
AbstractInitializableBeanDefinition.FieldReference
The data class containing all filed reference information.
|
static class |
AbstractInitializableBeanDefinition.MethodOrFieldReference
The shared data class between method and field reference.
|
static class |
AbstractInitializableBeanDefinition.MethodReference
The data class containing all method reference information.
|
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
EMPTY
Modifier | Constructor and Description |
---|---|
protected |
AbstractInitializableBeanDefinition(Class<T> beanType,
AbstractInitializableBeanDefinition.MethodOrFieldReference constructor,
AnnotationMetadata annotationMetadata,
AbstractInitializableBeanDefinition.MethodReference[] methodInjection,
AbstractInitializableBeanDefinition.FieldReference[] fieldInjection,
AbstractInitializableBeanDefinition.AnnotationReference[] annotationInjection,
ExecutableMethodsDefinition<T> executableMethodsDefinition,
Map<String,Argument<?>[]> typeArgumentsMap,
Optional<String> scope,
boolean isAbstract,
boolean isProvided,
boolean isIterable,
boolean isSingleton,
boolean isPrimary,
boolean isConfigurationProperties,
boolean isContainerType,
boolean requiresMethodProcessing) |
protected |
AbstractInitializableBeanDefinition(Class<T> beanType,
AbstractInitializableBeanDefinition.MethodOrFieldReference constructor,
AnnotationMetadata annotationMetadata,
AbstractInitializableBeanDefinition.MethodReference[] methodInjection,
AbstractInitializableBeanDefinition.FieldReference[] fieldInjection,
ExecutableMethodsDefinition<T> executableMethodsDefinition,
Map<String,Argument<?>[]> typeArgumentsMap,
Optional<String> scope,
boolean isAbstract,
boolean isProvided,
boolean isIterable,
boolean isSingleton,
boolean isPrimary,
boolean isConfigurationProperties,
boolean isContainerType,
boolean requiresMethodProcessing) |
Modifier and Type | Method and Description |
---|---|
T |
build(BeanResolutionContext resolutionContext,
BeanContext context,
BeanDefinition<T> definition,
Map<String,Object> requiredArgumentValues)
Implementing possible
ParametrizedBeanFactory.build(BeanResolutionContext, BeanContext, BeanDefinition) . |
protected void |
checkIfShouldLoad(BeanResolutionContext resolutionContext,
BeanContext context)
Checks whether the bean should be loaded.
|
protected void |
checkInjectedBeanPropertyValue(String injectedBeanPropertyName,
Object beanPropertyValue,
String requiredValue,
String notEqualsValue)
Check the value of the injected bean property to decide whether the
bean should be loaded.
|
void |
configure(Environment environment)
Configures the bean for the given
BeanContext . |
protected boolean |
containsProperties(BeanResolutionContext resolutionContext,
BeanContext context)
If this bean is a
ConfigurationProperties bean return whether any properties for it are configured
within the context. |
protected boolean |
containsProperties(BeanResolutionContext resolutionContext,
BeanContext context,
String subProperty)
If this bean is a
ConfigurationProperties bean return whether any properties for it are configured
within the context. |
protected boolean |
containsPropertiesValue(BeanResolutionContext resolutionContext,
BeanContext context,
String value) |
protected boolean |
containsPropertyValue(BeanResolutionContext resolutionContext,
BeanContext context,
String value) |
protected boolean |
containsValueForField(BeanResolutionContext resolutionContext,
BeanContext context,
int fieldIndex,
boolean isValuePrefix)
Deprecated.
|
protected boolean |
containsValueForMethodArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
int argIndex,
boolean isValuePrefix)
Deprecated.
|
protected T |
doBuild(BeanResolutionContext resolutionContext,
BeanContext context,
BeanDefinition<T> definition,
Map<String,Object> requiredArgumentValues)
Method to be implemented by the generated code if the bean definition is implementing
ParametrizedBeanFactory . |
boolean |
equals(Object o) |
protected Optional<?> |
findBeanForConstructorArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int argIndex,
Argument genericType,
Qualifier qualifier)
Obtains all bean definitions for a constructor argument at the given index
|
protected Optional |
findBeanForField(BeanResolutionContext resolutionContext,
BeanContext context,
int fieldIndex,
Argument genericType,
Qualifier qualifier)
Obtains a an optional for the field at the given index and the argument at the given index
|
protected Optional |
findBeanForMethodArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
int argIndex,
Argument genericType,
Qualifier qualifier)
Obtains an optional bean for the method at the given index and the argument at the given index
|
<R> Optional<ExecutableMethod<T,R>> |
findMethod(String name,
Class<?>... argumentTypes)
Finds a single
ExecutableMethod for the given name and argument types. |
<R> Stream<ExecutableMethod<T,R>> |
findPossibleMethods(String name)
Finds possible methods for the given method name.
|
AnnotationMetadata |
getAnnotationMetadata()
Supplies the metadata.
|
protected Object |
getBeanForAnnotation(BeanResolutionContext resolutionContext,
BeanContext context,
int annotationBeanIndex,
Qualifier qualifier) |
protected Object |
getBeanForConstructorArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int argIndex,
Qualifier qualifier)
Obtains a bean definition for a constructor at the given index
|
protected Object |
getBeanForField(BeanResolutionContext resolutionContext,
BeanContext context,
int fieldIndex,
Qualifier qualifier)
Obtains a bean definition for the field at the given index and the argument at the given index
|
protected Object |
getBeanForMethodArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
int argIndex,
Qualifier qualifier)
Obtains a bean definition for the method at the given index and the argument at the given index
|
protected Object |
getBeanForSetter(BeanResolutionContext resolutionContext,
BeanContext context,
String setterName,
Argument argument,
Qualifier qualifier)
Obtains a bean definition for the method at the given index and the argument at the given index
|
protected BeanRegistration<?> |
getBeanRegistrationForConstructorArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int argumentIndex,
Argument genericType,
Qualifier qualifier)
Obtains a bean registration for a method injection point.
|
protected BeanRegistration<?> |
getBeanRegistrationForField(BeanResolutionContext resolutionContext,
BeanContext context,
int fieldIndex,
Argument genericType,
Qualifier qualifier)
Obtains a bean registration for a field injection point.
|
protected BeanRegistration<?> |
getBeanRegistrationForMethodArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
int argIndex,
Argument genericType,
Qualifier qualifier)
Obtains a bean registration for a method injection point.
|
protected Collection<BeanRegistration<Object>> |
getBeanRegistrationsForConstructorArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int argumentIndex,
Argument genericType,
Qualifier qualifier)
Obtains all bean definitions for a constructor argument at the given index
|
protected Object |
getBeanRegistrationsForField(BeanResolutionContext resolutionContext,
BeanContext context,
int fieldIndex,
Argument genericType,
Qualifier qualifier)
Obtains all bean definitions for a field injection point.
|
protected Collection<BeanRegistration<Object>> |
getBeanRegistrationsForMethodArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
int argIndex,
Argument genericType,
Qualifier qualifier)
Obtains all bean definitions for a method injection point.
|
protected Collection<Object> |
getBeansOfTypeForConstructorArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int argumentIndex,
Argument genericType,
Qualifier qualifier)
Obtains all bean definitions for a constructor argument at the given index.
|
protected Object |
getBeansOfTypeForField(BeanResolutionContext resolutionContext,
BeanContext context,
int fieldIndex,
Argument genericType,
Qualifier qualifier)
Obtains all bean definitions for the field at the given index.
|
protected Collection<Object> |
getBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
int argumentIndex,
Argument genericType,
Qualifier qualifier)
Obtains all bean definitions for a method argument at the given index.
|
protected Collection<Object> |
getBeansOfTypeForSetter(BeanResolutionContext resolutionContext,
BeanContext context,
String setterName,
Argument argument,
Argument genericType,
Qualifier qualifier)
Obtains all bean definitions for a method argument at the given index.
|
Class<T> |
getBeanType()
Returns the bean type.
|
ConstructorInjectionPoint<T> |
getConstructor()
The single concrete constructor that is an injection point for creating the bean.
|
Optional<Argument<?>> |
getContainerElement()
If
BeanType.isContainerType() returns true this will return the container element. |
Optional<Class<?>> |
getDeclaringType() |
Collection<ExecutableMethod<T,?>> |
getExecutableMethods() |
Set<Class<?>> |
getExposedTypes()
Returns a potentially limited subset of bean types exposed by this bean.
|
List<FieldInjectionPoint<T,?>> |
getInjectedFields()
All the fields that require injection.
|
List<MethodInjectionPoint<T,?>> |
getInjectedMethods()
All methods that require injection.
|
String |
getName() |
List<MethodInjectionPoint<T,?>> |
getPostConstructMethods()
All the methods that should be called once the bean has been fully initialized and constructed.
|
List<MethodInjectionPoint<T,?>> |
getPreDestroyMethods()
All the methods that should be called when the object is to be destroyed.
|
protected Object |
getPropertyPlaceholderValueForConstructorArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int argIndex,
String propertyValue)
Obtains a property value for a bean definition for a constructor at the given index
|
protected Object |
getPropertyPlaceholderValueForField(BeanResolutionContext resolutionContext,
BeanContext context,
Argument argument,
String placeholder)
Deprecated.
|
protected Object |
getPropertyPlaceholderValueForMethodArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
int argIndex,
String value)
Obtains a placeholder value for the given method argument.
|
protected Object |
getPropertyPlaceholderValueForSetter(BeanResolutionContext resolutionContext,
BeanContext context,
String setterName,
Argument<?> argument,
String value)
Obtains a placeholder value for the given method argument.
|
protected Object |
getPropertyValueForConstructorArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int argIndex,
String propertyValue,
String cliProperty)
Obtains a property value for a bean definition for a constructor at the given index
|
protected Object |
getPropertyValueForField(BeanResolutionContext resolutionContext,
BeanContext context,
Argument argument,
String propertyValue,
String cliProperty)
Deprecated.
|
protected Object |
getPropertyValueForMethodArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
int argIndex,
String propertyValue,
String cliProperty)
Obtains a property value for the given method argument.
|
protected Object |
getPropertyValueForSetter(BeanResolutionContext resolutionContext,
BeanContext context,
String setterName,
Argument<?> argument,
String propertyValue,
String cliProperty)
Obtains a property value for the given method argument.
|
protected Object |
getProxiedBean(BeanContext beanContext)
Resolves the proxied bean instance for this bean.
|
Argument<?>[] |
getRequiredArguments()
Implementing possible
ParametrizedBeanFactory.getRequiredArguments() . |
Collection<Class<?>> |
getRequiredComponents() |
Optional<Class<? extends Annotation>> |
getScope() |
Optional<String> |
getScopeName() |
protected Stream<?> |
getStreamOfTypeForConstructorArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int argIndex,
Argument genericType,
Qualifier qualifier)
Obtains all bean definitions for a constructor argument at the given index
|
protected Stream |
getStreamOfTypeForField(BeanResolutionContext resolutionContext,
BeanContext context,
int fieldIndex,
Argument genericType,
Qualifier qualifier)
Obtains a bean definition for the field at the given index and the argument at the given index
|
protected Stream<?> |
getStreamOfTypeForMethodArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
int argIndex,
Argument genericType,
Qualifier qualifier)
Obtains all bean definitions for the method at the given index and the argument at the given index
|
List<Argument<?>> |
getTypeArguments(String type)
Return the type arguments for the given interface or super type for this bean.
|
protected Object |
getValueForConstructorArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int argIndex,
Qualifier qualifier)
Deprecated.
|
protected Object |
getValueForField(BeanResolutionContext resolutionContext,
BeanContext context,
int fieldIndex,
Qualifier qualifier)
Deprecated.
|
protected Object |
getValueForMethodArgument(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
int argIndex,
Qualifier qualifier)
Deprecated.
|
protected <T1> Optional<T1> |
getValueForPath(BeanResolutionContext resolutionContext,
BeanContext context,
Argument<T1> propertyType,
String propertyPath)
Resolve a value for the given field of the given type and path.
|
int |
hashCode() |
boolean |
hasPropertyExpressions()
Does the metadata contain any property expressions like
${foo.bar} . |
T |
inject(BeanContext context,
T bean)
Inject the given bean with the context.
|
T |
inject(BeanResolutionContext resolutionContext,
BeanContext context,
T bean)
Inject the given bean with the context.
|
protected Object |
injectAnother(BeanResolutionContext resolutionContext,
BeanContext context,
Object bean)
Inject another bean, for example one created via factory.
|
protected Object |
injectBean(BeanResolutionContext resolutionContext,
BeanContext context,
Object bean)
The default implementation which provides no injection.
|
protected void |
invokeMethodWithReflection(BeanResolutionContext resolutionContext,
BeanContext context,
int methodIndex,
Object bean,
Object[] methodArgs)
Invoke a bean method that requires reflection.
|
boolean |
isAbstract() |
boolean |
isContainerType()
Checks whether the bean type is a container type.
|
boolean |
isEnabled(BeanContext context,
BeanResolutionContext resolutionContext)
Return whether this component is enabled for the given context.
|
protected boolean |
isInnerConfiguration(Class<?> clazz)
Check if the class is an inner configuration.
|
boolean |
isIterable() |
boolean |
isPrimary() |
boolean |
isProvided() |
boolean |
isSingleton() |
protected Object |
postConstruct(BeanResolutionContext resolutionContext,
BeanContext context,
Object bean)
Default postConstruct hook that only invokes methods that require reflection.
|
protected Object |
preDestroy(BeanResolutionContext resolutionContext,
BeanContext context,
Object bean)
Default preDestroy hook that only invokes methods that require reflection.
|
boolean |
requiresMethodProcessing()
By default, when the
BeanContext is started, the
BeanDefinition.getExecutableMethods() are not processed by registered
ExecutableMethodProcessor instances unless this method returns true. |
protected void |
setFieldWithReflection(BeanResolutionContext resolutionContext,
BeanContext context,
int index,
Object object,
Object value)
Sets the value of a field of a object that requires reflection.
|
String |
toString() |
protected void |
warn(String message)
Allows printing warning messages produced by the compiler.
|
protected void |
warnMissingProperty(Class type,
String method,
String property)
Allows printing warning messages produced by the compiler.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asArgument, getDeclaredQualifier, getRequiredMethod, getTypeArguments, getTypeArguments, getTypeParameters, getTypeParameters, isCandidateBean, isProxy, resolveDynamicQualifier
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, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, 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
getAnnotationValuesByName, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
isEnabled, isEnabled
@Internal protected AbstractInitializableBeanDefinition(Class<T> beanType, @Nullable AbstractInitializableBeanDefinition.MethodOrFieldReference constructor, @Nullable AnnotationMetadata annotationMetadata, @Nullable AbstractInitializableBeanDefinition.MethodReference[] methodInjection, @Nullable AbstractInitializableBeanDefinition.FieldReference[] fieldInjection, @Nullable ExecutableMethodsDefinition<T> executableMethodsDefinition, @Nullable Map<String,Argument<?>[]> typeArgumentsMap, Optional<String> scope, boolean isAbstract, boolean isProvided, boolean isIterable, boolean isSingleton, boolean isPrimary, boolean isConfigurationProperties, boolean isContainerType, boolean requiresMethodProcessing)
@Internal protected AbstractInitializableBeanDefinition(Class<T> beanType, @Nullable AbstractInitializableBeanDefinition.MethodOrFieldReference constructor, @Nullable AnnotationMetadata annotationMetadata, @Nullable AbstractInitializableBeanDefinition.MethodReference[] methodInjection, @Nullable AbstractInitializableBeanDefinition.FieldReference[] fieldInjection, @Nullable AbstractInitializableBeanDefinition.AnnotationReference[] annotationInjection, @Nullable ExecutableMethodsDefinition<T> executableMethodsDefinition, @Nullable Map<String,Argument<?>[]> typeArgumentsMap, Optional<String> scope, boolean isAbstract, boolean isProvided, boolean isIterable, boolean isSingleton, boolean isPrimary, boolean isConfigurationProperties, boolean isContainerType, boolean requiresMethodProcessing)
public final boolean isContainerType()
BeanType
isContainerType
in interface BeanType<T>
Iterable
.public final Optional<Argument<?>> getContainerElement()
BeanDefinition
BeanType.isContainerType()
returns true this will return the container element.getContainerElement
in interface BeanDefinition<T>
public final boolean hasPropertyExpressions()
AnnotationMetadata
${foo.bar}
. Note
this by default returns true
as previous versions of Micronaut must assume metadata
is present. The compilation time this is computed in order to decide whether to instrument
annotation metadata with environment specific logic.hasPropertyExpressions
in interface EnvironmentConfigurable
hasPropertyExpressions
in interface AnnotationMetadata
hasPropertyExpressions
in interface AnnotationMetadataDelegate
@NonNull public final List<Argument<?>> getTypeArguments(String type)
BeanDefinition
getTypeArguments
in interface BeanDefinition<T>
type
- The super class or interface type@NonNull public AnnotationMetadata getAnnotationMetadata()
AnnotationMetadataProvider
AnnotationMetadata.EMPTY_METADATA
.getAnnotationMetadata
in interface AnnotationMetadataProvider
AnnotationMetadata
public boolean isAbstract()
isAbstract
in interface BeanDefinition<T>
public boolean isIterable()
isIterable
in interface BeanDefinition<T>
EachProperty
or
EachBean
public boolean isPrimary()
public boolean isProvided()
isProvided
in interface BeanDefinition<T>
Provided
public boolean requiresMethodProcessing()
BeanType
BeanContext
is started, the
BeanDefinition.getExecutableMethods()
are not processed by registered
ExecutableMethodProcessor
instances unless this method returns true.requiresMethodProcessing
in interface BeanType<T>
Executable.processOnStartup()
public final <R> Optional<ExecutableMethod<T,R>> findMethod(String name, Class<?>... argumentTypes)
BeanDefinition
ExecutableMethod
for the given name and argument types.findMethod
in interface BeanDefinition<T>
R
- The return typename
- The method nameargumentTypes
- The argument typesExecutableMethod
public final <R> Stream<ExecutableMethod<T,R>> findPossibleMethods(String name)
BeanDefinition
findPossibleMethods
in interface BeanDefinition<T>
R
- The return typename
- The method namepublic boolean isSingleton()
isSingleton
in interface BeanDefinition<T>
public final Optional<Class<? extends Annotation>> getScope()
getScope
in interface BeanDefinition<T>
public final Optional<String> getScopeName()
getScopeName
in interface BeanDefinition<T>
public final Class<T> getBeanType()
BeanType
getBeanType
in interface BeanDefinition<T>
getBeanType
in interface BeanType<T>
@NonNull public Set<Class<?>> getExposedTypes()
BeanType
Type
annotation.getExposedTypes
in interface BeanType<T>
public final Optional<Class<?>> getDeclaringType()
getDeclaringType
in interface BeanDefinition<T>
public final ConstructorInjectionPoint<T> getConstructor()
BeanDefinition
getConstructor
in interface BeanDefinition<T>
public final Collection<Class<?>> getRequiredComponents()
getRequiredComponents
in interface BeanDefinition<T>
public final List<MethodInjectionPoint<T,?>> getInjectedMethods()
BeanDefinition
getInjectedMethods
in interface BeanDefinition<T>
public final List<FieldInjectionPoint<T,?>> getInjectedFields()
BeanDefinition
getInjectedFields
in interface BeanDefinition<T>
public final List<MethodInjectionPoint<T,?>> getPostConstructMethods()
BeanDefinition
getPostConstructMethods
in interface BeanDefinition<T>
public final List<MethodInjectionPoint<T,?>> getPreDestroyMethods()
BeanDefinition
getPreDestroyMethods
in interface BeanDefinition<T>
public T inject(BeanContext context, T bean)
BeanDefinition
inject
in interface BeanDefinition<T>
context
- The contextbean
- The beanpublic T inject(BeanResolutionContext resolutionContext, BeanContext context, T bean)
BeanDefinition
inject
in interface BeanDefinition<T>
resolutionContext
- the resolution contextcontext
- The contextbean
- The beanpublic final Collection<ExecutableMethod<T,?>> getExecutableMethods()
getExecutableMethods
in interface BeanDefinition<T>
ExecutableMethod
instances for this definition@Internal public final void configure(Environment environment)
BeanContext
. If the context features an
Environment
this method configures the annotation metadata such that
environment aware values are returned.configure
in interface EnvironmentConfigurable
environment
- The environment@Internal protected final void warn(String message)
message
- The message@Internal protected final void warnMissingProperty(Class type, String method, String property)
type
- The typemethod
- The methodproperty
- The property@Internal protected final Object getProxiedBean(BeanContext beanContext)
beanContext
- The BeanContext
public final Argument<?>[] getRequiredArguments()
ParametrizedBeanFactory.getRequiredArguments()
.public final T build(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, Map<String,Object> requiredArgumentValues) throws BeanInstantiationException
ParametrizedBeanFactory.build(BeanResolutionContext, BeanContext, BeanDefinition)
.resolutionContext
- The BeanResolutionContext
context
- The BeanContext
definition
- The BeanDefinition
requiredArgumentValues
- The required arguments values. The keys should match the names of the arguments
returned by getRequiredArguments()
BeanInstantiationException
- If the bean cannot be instantiated for the arguments supplied@Internal protected T doBuild(BeanResolutionContext resolutionContext, BeanContext context, BeanDefinition<T> definition, Map<String,Object> requiredArgumentValues)
ParametrizedBeanFactory
.resolutionContext
- The resolution contextcontext
- The bean contextdefinition
- The bean definitionrequiredArgumentValues
- The required arguments@Internal protected Object injectBean(BeanResolutionContext resolutionContext, BeanContext context, Object bean)
resolutionContext
- The resolution contextcontext
- The bean contextbean
- The bean@Internal protected Object injectAnother(BeanResolutionContext resolutionContext, BeanContext context, Object bean)
resolutionContext
- The reslution contextcontext
- The contextbean
- The bean@Internal protected Object postConstruct(BeanResolutionContext resolutionContext, BeanContext context, Object bean)
resolutionContext
- The resolution hookcontext
- The contextbean
- The bean@Internal protected Object preDestroy(BeanResolutionContext resolutionContext, BeanContext context, Object bean)
resolutionContext
- The resolution hookcontext
- The contextbean
- The bean@Internal protected boolean isInnerConfiguration(Class<?> clazz)
clazz
- The class to check@Internal protected void checkIfShouldLoad(BeanResolutionContext resolutionContext, BeanContext context)
resolutionContext
- - the resolution contextcontext
- - the bean context@Internal protected final void checkInjectedBeanPropertyValue(String injectedBeanPropertyName, @Nullable Object beanPropertyValue, @Nullable String requiredValue, @Nullable String notEqualsValue)
injectedBeanPropertyName
- the name of the injected bean propertybeanPropertyValue
- the value of injected bean propertyrequiredValue
- the value which is required for the bean to be loadednotEqualsValue
- the value which bean property should not be equal to for the bean to be loaded@Internal protected final void invokeMethodWithReflection(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, Object bean, Object[] methodArgs)
resolutionContext
- The resolution contextcontext
- The bean contextmethodIndex
- The method indexbean
- The beanmethodArgs
- The method args@Internal protected final void setFieldWithReflection(BeanResolutionContext resolutionContext, BeanContext context, int index, Object object, Object value)
resolutionContext
- The resolution contextcontext
- The object contextindex
- The index of the fieldobject
- The object whose field should be modifievalue
- The instance being set@Internal @Deprecated protected final Object getValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Qualifier qualifier)
resolutionContext
- The resolution contextcontext
- The bean contextmethodIndex
- The method indexargIndex
- The argument indexqualifier
- The qualifier@Internal protected final Object getPropertyValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, String propertyValue, String cliProperty)
resolutionContext
- The resolution contextcontext
- The bean contextmethodIndex
- The method indexargIndex
- The argument indexpropertyValue
- The property valuecliProperty
- The cli property@Internal protected final Object getPropertyPlaceholderValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, String value)
resolutionContext
- The resolution contextcontext
- The bean contextmethodIndex
- The method indexargIndex
- The argument indexvalue
- The property value@Internal protected final Object getPropertyValueForSetter(BeanResolutionContext resolutionContext, BeanContext context, String setterName, Argument<?> argument, String propertyValue, String cliProperty)
resolutionContext
- The resolution contextcontext
- The bean contextsetterName
- The setter nameargument
- The argumentpropertyValue
- The property valuecliProperty
- The cli property@Internal protected final Object getPropertyPlaceholderValueForSetter(BeanResolutionContext resolutionContext, BeanContext context, String setterName, Argument<?> argument, String value)
resolutionContext
- The resolution contextcontext
- The bean contextsetterName
- The setter nameargument
- The argumentvalue
- The value@Internal @Deprecated protected final boolean containsValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, boolean isValuePrefix)
resolutionContext
- The resolution contextcontext
- The bean contextmethodIndex
- The method indexargIndex
- The argument indexisValuePrefix
- Is value prefix in cases when beans are requested@Internal protected final Object getBeanForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextmethodIndex
- The method indexargIndex
- The argument indexqualifier
- The qualifier@Internal protected final Collection<Object> getBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argumentIndex, Argument genericType, Qualifier qualifier)
resolutionContext
- The resolution contextcontext
- The contextmethodIndex
- The method indexargumentIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Object getBeanForSetter(BeanResolutionContext resolutionContext, BeanContext context, String setterName, Argument argument, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextsetterName
- The setter nameargument
- The argumentqualifier
- The qualifier@Internal protected final Collection<Object> getBeansOfTypeForSetter(BeanResolutionContext resolutionContext, BeanContext context, String setterName, Argument argument, Argument genericType, Qualifier qualifier)
resolutionContext
- The resolution contextcontext
- The contextsetterName
- The setter nameargument
- The argumentgenericType
- The generic typequalifier
- The qualifier@Internal protected final Optional findBeanForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextmethodIndex
- The method indexargIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Stream<?> getStreamOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextmethodIndex
- The method indexargIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Object getBeanForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextargIndex
- The argument indexqualifier
- The qualifier@Internal @Deprecated protected final Object getValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextargIndex
- The argument indexqualifier
- The qualifier@Internal protected final Object getPropertyValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, String propertyValue, String cliProperty)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextargIndex
- The argument indexpropertyValue
- The property valuecliProperty
- The cli property@Internal protected final Object getPropertyPlaceholderValueForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, String propertyValue)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextargIndex
- The argument indexpropertyValue
- The property value@Internal protected final Collection<Object> getBeansOfTypeForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, Argument genericType, Qualifier qualifier)
resolutionContext
- The resolution contextcontext
- The contextargumentIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Collection<BeanRegistration<Object>> getBeanRegistrationsForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextargumentIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final BeanRegistration<?> getBeanRegistrationForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argumentIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextargumentIndex
- The arg indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Collection<BeanRegistration<Object>> getBeanRegistrationsForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextmethodIndex
- The method indexargIndex
- The arg indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final BeanRegistration<?> getBeanRegistrationForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextmethodIndex
- The method indexargIndex
- The arg indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Stream<?> getStreamOfTypeForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextargIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Optional<?> findBeanForConstructorArgument(BeanResolutionContext resolutionContext, BeanContext context, int argIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextargIndex
- The argument indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Object getBeanForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextfieldIndex
- The field indexqualifier
- The qualifier@Internal protected final Object getBeanForAnnotation(BeanResolutionContext resolutionContext, BeanContext context, int annotationBeanIndex, Qualifier qualifier)
@Internal @Deprecated protected final Object getValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextfieldIndex
- The index of the fieldqualifier
- The qualifier@Internal @Deprecated protected final Object getPropertyValueForField(BeanResolutionContext resolutionContext, BeanContext context, Argument argument, String propertyValue, String cliProperty)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextargument
- The argumentpropertyValue
- The property valuecliProperty
- The clie property name@Internal @Deprecated protected final Object getPropertyPlaceholderValueForField(BeanResolutionContext resolutionContext, BeanContext context, Argument argument, String placeholder)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextargument
- The argumentplaceholder
- The placeholder@Internal protected final <T1> Optional<T1> getValueForPath(BeanResolutionContext resolutionContext, BeanContext context, Argument<T1> propertyType, String propertyPath)
T1
- The generic typeresolutionContext
- The resolution contextcontext
- The bean contextpropertyType
- The required property typepropertyPath
- The property path@Internal @Deprecated protected final boolean containsValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, boolean isValuePrefix)
resolutionContext
- The resolution contextcontext
- The bean contextfieldIndex
- The field indexisValuePrefix
- Is value prefix in cases when beans are requested@Internal protected final boolean containsProperties(BeanResolutionContext resolutionContext, BeanContext context)
ConfigurationProperties
bean return whether any properties for it are configured
within the context.resolutionContext
- the resolution contextcontext
- The context@Internal protected final boolean containsProperties(BeanResolutionContext resolutionContext, BeanContext context, String subProperty)
ConfigurationProperties
bean return whether any properties for it are configured
within the context.resolutionContext
- the resolution contextcontext
- The contextsubProperty
- The subproperty to check@Internal protected final Object getBeansOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument genericType, Qualifier qualifier)
resolutionContext
- The resolution contextcontext
- The contextfieldIndex
- The field indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Object getBeanRegistrationsForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextfieldIndex
- The field indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final BeanRegistration<?> getBeanRegistrationForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextfieldIndex
- The field indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Optional findBeanForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextfieldIndex
- The field indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final Stream getStreamOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex, Argument genericType, Qualifier qualifier)
Warning: this method is used by internal generated code and should not be called by user code.
resolutionContext
- The resolution contextcontext
- The contextfieldIndex
- The field indexgenericType
- The generic typequalifier
- The qualifier@Internal protected final boolean containsPropertiesValue(BeanResolutionContext resolutionContext, BeanContext context, String value)
@Internal protected final boolean containsPropertyValue(BeanResolutionContext resolutionContext, BeanContext context, String value)
public boolean isEnabled(@NonNull BeanContext context, @Nullable BeanResolutionContext resolutionContext)
BeanContextConditional
isEnabled
in interface BeanContextConditional
context
- The contextresolutionContext
- The bean resolution context