Package io.micronaut.aop.chain
Class ConstructorInterceptorChain<T>
java.lang.Object
io.micronaut.aop.chain.ConstructorInterceptorChain<T>
- Type Parameters:
- T- The bean type
- All Implemented Interfaces:
- ConstructorInvocationContext<T>,- InvocationContext<T,,- T> - AnnotationMetadata,- AnnotationMetadataDelegate,- AnnotationMetadataProvider,- AnnotationSource,- AttributeHolder,- MutableAttributeHolder,- Executable<T,- T> 
@Internal
public final class ConstructorInterceptorChain<T>
extends Object
implements ConstructorInvocationContext<T>
Implementation of 
InvocationContext for constructor interception.- Since:
- 3.0.0
- Author:
- graemerocher
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected MutableConvertibleValues<Object>protected intprotected final intprotected final Interceptor<T,T>[] protected static final org.slf4j.LoggerUsed by subclasses!protected final Object[]protected Map<String,MutableArgumentValue<?>> Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadataCLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBERFields inherited from interface io.micronaut.core.annotation.AnnotationSourceEMPTY
- 
Method SummaryModifier and TypeMethodDescriptionThe required argument types.Overrides the defaultAttributeHolder.getAttributes()method to return a mutable object.getKind()Returns the current parameters as a map of mutable argument values.Returns the current state of the parameters as an array by parameter index.static <T1> T1instantiate(@NonNull BeanResolutionContext resolutionContext, @NonNull BeanContext beanContext, @Nullable List<BeanRegistration<Interceptor<T1, T1>>> interceptors, @NonNull BeanDefinition<T1> definition, @NonNull BeanConstructor<T1> constructor, int additionalProxyConstructorParametersCount, @NonNull Object... parameters) Internal methods that handles the logic of instantiating a bean that has constructor interception applied.static <T1> T1instantiate(@NonNull BeanResolutionContext resolutionContext, @NonNull BeanContext beanContext, @Nullable List<BeanRegistration<Interceptor<T1, T1>>> interceptors, @NonNull BeanDefinition<T1> definition, @NonNull BeanConstructor<T1> constructor, @NonNull Object... parameters) Deprecated.Invokes the method.proceed()Proceeds with the invocation.proceed(@NonNull Interceptor from) Proceeds with the invocation using the given interceptor as a position to start from.protected static @NonNull Collection<AnnotationValue<?>>resolveInterceptorValues(@NonNull AnnotationMetadata annotationMetadata, @NonNull InterceptorKind kind) Resolve interceptor binding for the given annotation metadata and kind.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadataenumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresentMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegatebooleanValue, 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.core.annotation.AnnotationMetadataProvidergetAnnotationMetadataMethods inherited from interface io.micronaut.core.attr.AttributeHoldergetAttribute, getAttributeMethods inherited from interface io.micronaut.aop.ConstructorInvocationContextgetDeclaringType, proceedMethods inherited from interface io.micronaut.aop.InvocationContextgetParameters, getParameterValueMap, getParameterValues, setAttributeMethods inherited from interface io.micronaut.core.attr.MutableAttributeHoldergetAttributes, removeAttribute
- 
Field Details- 
LOGprotected static final org.slf4j.Logger LOGUsed by subclasses!
- 
interceptors
- 
originalParameters
- 
interceptorCountprotected final int interceptorCount
- 
attributes
- 
indexprotected int index
- 
parameters
 
- 
- 
Method Details- 
getKind- Specified by:
- getKindin interface- InvocationContext<T,- T> 
- Returns:
- An enum representing the kind of interception that is occurring.
 
- 
getTarget- Specified by:
- getTargetin interface- InvocationContext<T,- T> 
- Returns:
- The target object
 
- 
proceedDescription copied from interface:InvocationContextProceeds with the invocation. If this is the last interceptor in the chain then the final implementation method is invoked- Specified by:
- proceedin interface- ConstructorInvocationContext<T>
- Specified by:
- proceedin interface- InvocationContext<T,- T> 
- Returns:
- The return value of the method
- Throws:
- RuntimeException- chain may throw RTE
 
- 
getArgumentsDescription copied from interface:ExecutableThe required argument types.- Specified by:
- getArgumentsin interface- Executable<T,- T> 
- Returns:
- The arguments
 
- 
invokeDescription copied from interface:ExecutableInvokes the method.- Specified by:
- invokein interface- Executable<T,- T> 
- Parameters:
- instance- The instance. Nullable only if it's a static method call.
- arguments- The arguments
- Returns:
- The result
 
- 
getConstructor- Specified by:
- getConstructorin interface- ConstructorInvocationContext<T>
- Returns:
- The bean type.
 
- 
instantiate@Internal @NonNull @Deprecated public static <T1> T1 instantiate(@NonNull @NonNull BeanResolutionContext resolutionContext, @NonNull @NonNull BeanContext beanContext, @Nullable @Nullable List<BeanRegistration<Interceptor<T1, T1>>> interceptors, @NonNull @NonNull BeanDefinition<T1> definition, @NonNull @NonNull BeanConstructor<T1> constructor, @NonNull @NonNull Object... parameters) Deprecated.Internal methods that handles the logic of instantiating a bean that has constructor interception applied.- Type Parameters:
- T1- The bean type
- Parameters:
- resolutionContext- The resolution context
- beanContext- The bean context
- interceptors- The interceptors. Can be null and if so should be resolved from the context.
- definition- The definition
- constructor- The bean constructor
- parameters- The resolved parameters
- Returns:
- The instantiated bean
- Since:
- 3.0.0
 
- 
instantiate@Internal @NonNull public static <T1> T1 instantiate(@NonNull @NonNull BeanResolutionContext resolutionContext, @NonNull @NonNull BeanContext beanContext, @Nullable @Nullable List<BeanRegistration<Interceptor<T1, T1>>> interceptors, @NonNull @NonNull BeanDefinition<T1> definition, @NonNull @NonNull BeanConstructor<T1> constructor, int additionalProxyConstructorParametersCount, @NonNull @NonNull Object... parameters) Internal methods that handles the logic of instantiating a bean that has constructor interception applied.- Type Parameters:
- T1- The bean type
- Parameters:
- resolutionContext- The resolution context
- beanContext- The bean context
- interceptors- The interceptors. Can be null and if so should be resolved from the context.
- definition- The definition
- constructor- The bean constructor
- additionalProxyConstructorParametersCount- The additional proxy constructor parameters count
- parameters- The resolved parameters
- Returns:
- The instantiated bean
- Since:
- 3.0.0
 
- 
getParameterValuesDescription copied from interface:InvocationContextReturns the current state of the parameters as an array by parameter index. Note that mutations to the array have no effect. If you wish to mutate the parameters useInvocationContext.getParameters()and theMutableArgumentValueinterface instead- Specified by:
- getParameterValuesin interface- InvocationContext<B,- R> 
- Returns:
- The bound ArgumentValueinstances
 
- 
getAttributesDescription copied from interface:MutableAttributeHolderOverrides the defaultAttributeHolder.getAttributes()method to return a mutable object.- Specified by:
- getAttributesin interface- AttributeHolder
- Specified by:
- getAttributesin interface- MutableAttributeHolder
- Returns:
- The mutable attributes
 
- 
getParametersDescription copied from interface:InvocationContextReturns the current parameters as a map of mutable argument values. This method allows mutation of the argument values and is generally more expensive than usingInvocationContext.getParameterValues()andExecutable.getArguments()directly, hence should be used with care.- Specified by:
- getParametersin interface- InvocationContext<B,- R> 
- Returns:
- The bound ArgumentValueinstances
 
- 
proceedDescription copied from interface:InvocationContextProceeds with the invocation using the given interceptor as a position to start from. Mainly useful forIntroductionadvise where you want to invoke the target multiple times or where you want to repeat the entire chain.- Specified by:
- proceedin interface- InvocationContext<B,- R> 
- Parameters:
- from- The interceptor to start from (note: will not be included in the execution)
- Returns:
- The return value of the method
- Throws:
- RuntimeException- chain may throw RTE
 
- 
resolveInterceptorValues@NonNull protected static @NonNull Collection<AnnotationValue<?>> resolveInterceptorValues(@NonNull @NonNull AnnotationMetadata annotationMetadata, @NonNull @NonNull InterceptorKind kind) Resolve interceptor binding for the given annotation metadata and kind.- Parameters:
- annotationMetadata- The annotation metadata
- kind- The kind
- Returns:
- The binding
- Since:
- 3.3.0
 
 
-