T - typeR - result@Internal public final class MethodInterceptorChain<T,R> extends InterceptorChain<T,R> implements MethodInvocationContext<T,R>
Interceptor chain. This class implements MethodInvocationContext and is
consumed by the framework itself and should not be used directly in application code.| Modifier and Type | Field and Description |
|---|---|
protected io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
attributes |
protected int |
index |
protected int |
interceptorCount |
protected Interceptor<B,R>[] |
interceptors |
protected static org.slf4j.Logger |
LOG
Used by subclasses!
|
protected java.lang.Object[] |
originalParameters |
protected java.util.Map<java.lang.String,io.micronaut.core.type.MutableArgumentValue<?>> |
parameters |
executionHandle, target| Constructor and Description |
|---|
MethodInterceptorChain(Interceptor<T,R>[] interceptors,
T target,
io.micronaut.inject.ExecutableMethod<T,R> executionHandle)
Constructor for empty parameters.
|
MethodInterceptorChain(Interceptor<T,R>[] interceptors,
T target,
io.micronaut.inject.ExecutableMethod<T,R> executionHandle,
InterceptorKind kind)
Constructor for empty parameters.
|
MethodInterceptorChain(Interceptor<T,R>[] interceptors,
T target,
io.micronaut.inject.ExecutableMethod<T,R> executionHandle,
java.lang.Object... originalParameters)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static <T1> T1 |
dispose(io.micronaut.context.BeanResolutionContext resolutionContext,
io.micronaut.context.BeanContext beanContext,
io.micronaut.inject.BeanDefinition<T1> definition,
io.micronaut.inject.ExecutableMethod<T1,T1> preDestroyMethod,
T1 bean)
Internal method that handles the logic for executing
InterceptorKind.PRE_DESTROY interception. |
java.lang.Class[] |
getArgumentTypes() |
io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
getAttributes() |
java.lang.Class<T> |
getDeclaringType() |
io.micronaut.inject.ExecutableMethod<T,R> |
getExecutableMethod()
The underlying
ExecutableMethod reference. |
InterceptorKind |
getKind() |
java.lang.String |
getMethodName() |
java.util.Map<java.lang.String,io.micronaut.core.type.MutableArgumentValue<?>> |
getParameters()
Returns the current parameters as a map of mutable argument values.
|
java.lang.Object[] |
getParameterValues()
Returns the current state of the parameters as an array by parameter index.
|
io.micronaut.core.type.ReturnType<R> |
getReturnType() |
java.lang.reflect.Method |
getTargetMethod() |
static <T1> T1 |
initialize(io.micronaut.context.BeanResolutionContext resolutionContext,
io.micronaut.context.BeanContext beanContext,
io.micronaut.inject.BeanDefinition<T1> definition,
io.micronaut.inject.ExecutableMethod<T1,T1> postConstructMethod,
T1 bean)
Internal method that handles the logic for executing
InterceptorKind.POST_CONSTRUCT interception. |
R |
invoke(T instance,
java.lang.Object... arguments) |
boolean |
isAbstract() |
boolean |
isSuspend() |
R |
proceed()
Proceeds with the invocation.
|
R |
proceed(Interceptor from)
Proceeds with the invocation using the given interceptor as a position to start from.
|
protected static java.util.Collection<io.micronaut.core.annotation.AnnotationValue<?>> |
resolveInterceptorValues(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata,
InterceptorKind kind)
Resolve interceptor binding for the given annotation metadata and kind.
|
java.lang.String |
toString() |
getAnnotationMetadata, getArguments, getTarget, resolveAroundInterceptors, resolveAroundInterceptors, resolveIntroductionInterceptors, resolveIntroductionInterceptorsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetParameters, getParameterValueMap, getParameterValues, getTarget, proceed, setAttributegetAttributes, removeAttributegetDescription, getDescriptiongetArgumentNames, getArguments, getNamebooleanValue, 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, synthesizeDeclaredAnnotationsByTypegetAnnotationValuesByName, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresentprotected static final org.slf4j.Logger LOG
protected final Interceptor<B,R>[] interceptors
protected final java.lang.Object[] originalParameters
protected final int interceptorCount
protected volatile io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> attributes
protected int index
protected volatile java.util.Map<java.lang.String,io.micronaut.core.type.MutableArgumentValue<?>> parameters
public MethodInterceptorChain(Interceptor<T,R>[] interceptors, T target, io.micronaut.inject.ExecutableMethod<T,R> executionHandle)
interceptors - array of interceptorstarget - targetexecutionHandle - executionHandlepublic MethodInterceptorChain(Interceptor<T,R>[] interceptors, T target, io.micronaut.inject.ExecutableMethod<T,R> executionHandle, @Nullable InterceptorKind kind)
interceptors - array of interceptorstarget - targetexecutionHandle - executionHandlekind - The interception kindpublic MethodInterceptorChain(Interceptor<T,R>[] interceptors, T target, io.micronaut.inject.ExecutableMethod<T,R> executionHandle, java.lang.Object... originalParameters)
interceptors - array of interceptorstarget - targetexecutionHandle - executionHandleoriginalParameters - originalParameters@NonNull public InterceptorKind getKind()
getKind in interface InvocationContext<T,R>public boolean isSuspend()
public boolean isAbstract()
isAbstract in interface MethodInvocationContext<T,R>isAbstract in interface io.micronaut.inject.ExecutableMethod<T,R>public R proceed() throws java.lang.RuntimeException
InvocationContextproceed in interface InvocationContext<T,R>proceed in class InterceptorChain<T,R>java.lang.RuntimeException - chain may throw RTEpublic java.lang.String getMethodName()
public java.lang.Class[] getArgumentTypes()
public java.lang.reflect.Method getTargetMethod()
public io.micronaut.core.type.ReturnType<R> getReturnType()
public java.lang.Class<T> getDeclaringType()
getDeclaringType in interface InvocationContext<T,R>getDeclaringType in interface MethodInvocationContext<T,R>getDeclaringType in interface io.micronaut.core.type.Executable<T,R>getDeclaringType in interface io.micronaut.inject.MethodReference<T,R>public java.lang.String toString()
toString in class java.lang.Object@NonNull public io.micronaut.inject.ExecutableMethod<T,R> getExecutableMethod()
MethodInvocationContextExecutableMethod reference.getExecutableMethod in interface MethodInvocationContext<T,R>@Internal
@NonNull
public static <T1> T1 initialize(@NonNull
io.micronaut.context.BeanResolutionContext resolutionContext,
@NonNull
io.micronaut.context.BeanContext beanContext,
@NonNull
io.micronaut.inject.BeanDefinition<T1> definition,
@NonNull
io.micronaut.inject.ExecutableMethod<T1,T1> postConstructMethod,
@NonNull
T1 bean)
InterceptorKind.POST_CONSTRUCT interception.T1 - The bean typeresolutionContext - The resolution contextbeanContext - The bean contextdefinition - The definitionpostConstructMethod - The post construct methodbean - The bean@Internal
@NonNull
public static <T1> T1 dispose(@NonNull
io.micronaut.context.BeanResolutionContext resolutionContext,
@NonNull
io.micronaut.context.BeanContext beanContext,
@NonNull
io.micronaut.inject.BeanDefinition<T1> definition,
@NonNull
io.micronaut.inject.ExecutableMethod<T1,T1> preDestroyMethod,
@NonNull
T1 bean)
InterceptorKind.PRE_DESTROY interception.T1 - The bean typeresolutionContext - The resolution contextbeanContext - The bean contextdefinition - The definitionpreDestroyMethod - The pre destroy methodbean - The bean@NonNull public java.lang.Object[] getParameterValues()
InvocationContextInvocationContext.getParameters() and the MutableArgumentValue interface insteadgetParameterValues in interface InvocationContext<B,R>ArgumentValue instances@NonNull public io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> getAttributes()
getAttributes in interface io.micronaut.core.attr.AttributeHoldergetAttributes in interface io.micronaut.core.attr.MutableAttributeHolder@NonNull public java.util.Map<java.lang.String,io.micronaut.core.type.MutableArgumentValue<?>> getParameters()
InvocationContextInvocationContext.getParameterValues() and Executable.getArguments() directly, hence
should be used with care.getParameters in interface InvocationContext<B,R>ArgumentValue instancespublic R proceed(@NonNull
Interceptor from)
throws java.lang.RuntimeException
InvocationContextIntroduction advise where you want to
invoke the target multiple times or where you want to repeat the entire chain.proceed in interface InvocationContext<B,R>from - The interceptor to start from (note: will not be included in the execution)java.lang.RuntimeException - chain may throw RTE@NonNull
protected static java.util.Collection<io.micronaut.core.annotation.AnnotationValue<?>> resolveInterceptorValues(@NonNull
io.micronaut.core.annotation.AnnotationMetadata annotationMetadata,
@NonNull
InterceptorKind kind)
annotationMetadata - The annotation metadatakind - The kind