Package io.micronaut.context
Class AbstractExecutableMethod
- java.lang.Object
-
- io.micronaut.context.AbstractExecutableMethod
-
- All Implemented Interfaces:
EnvironmentConfigurable
,io.micronaut.core.annotation.AnnotatedElement
,io.micronaut.core.annotation.AnnotationMetadata
,io.micronaut.core.annotation.AnnotationMetadataDelegate
,io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,io.micronaut.core.naming.Described
,io.micronaut.core.naming.Named
,io.micronaut.core.type.Executable
,ExecutableMethod
,MethodReference
@Internal public abstract class AbstractExecutableMethod extends java.lang.Object implements ExecutableMethod, EnvironmentConfigurable
Abstract base class for generated
ExecutableMethod
classes to implement. The generated classes should implement theExecutable.invoke(Object, Object...)
method at compile time providing direct dispatch of the target method- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Class[]
argTypes
protected java.lang.Class
declaringType
protected java.lang.String
methodName
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractExecutableMethod(java.lang.Class<?> declaringType, java.lang.String methodName)
protected
AbstractExecutableMethod(java.lang.Class<?> declaringType, java.lang.String methodName, io.micronaut.core.type.Argument genericReturnType)
protected
AbstractExecutableMethod(java.lang.Class<?> declaringType, java.lang.String methodName, io.micronaut.core.type.Argument genericReturnType, io.micronaut.core.type.Argument... arguments)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
configure(Environment environment)
Configure the component for the given environment.boolean
equals(java.lang.Object o)
io.micronaut.core.annotation.AnnotationMetadata
getAnnotationMetadata()
io.micronaut.core.type.Argument<?>[]
getArguments()
java.lang.Class[]
getArgumentTypes()
java.lang.Class
getDeclaringType()
java.lang.String
getMethodName()
io.micronaut.core.type.ReturnType
getReturnType()
java.lang.reflect.Method
getTargetMethod()
Soft resolves the targetMethod
avoiding reflection until as late as possible.int
hashCode()
boolean
hasPropertyExpressions()
java.lang.Object
invoke(java.lang.Object instance, java.lang.Object... arguments)
protected abstract java.lang.Object
invokeInternal(java.lang.Object instance, java.lang.Object[] arguments)
protected io.micronaut.core.annotation.AnnotationMetadata
resolveAnnotationMetadata()
Resolves the annotation metadata for this method.protected java.lang.reflect.Method
resolveTargetMethod()
Resolves the target method.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
-
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.ExecutableMethod
getDescription, getDescription, isAbstract, isSuspend
-
Methods inherited from interface io.micronaut.inject.MethodReference
getArgumentNames, getArguments, getName, getTargetMethod
-
-
-
-
Constructor Detail
-
AbstractExecutableMethod
protected AbstractExecutableMethod(java.lang.Class<?> declaringType, java.lang.String methodName, io.micronaut.core.type.Argument genericReturnType, io.micronaut.core.type.Argument... arguments)
- Parameters:
declaringType
- The declaring typemethodName
- The method namegenericReturnType
- The generic return typearguments
- The arguments
-
AbstractExecutableMethod
protected AbstractExecutableMethod(java.lang.Class<?> declaringType, java.lang.String methodName, io.micronaut.core.type.Argument genericReturnType)
- Parameters:
declaringType
- The declaring typemethodName
- The method namegenericReturnType
- The generic return type
-
AbstractExecutableMethod
protected AbstractExecutableMethod(java.lang.Class<?> declaringType, java.lang.String methodName)
- Parameters:
declaringType
- The declaring typemethodName
- The method name
-
-
Method Detail
-
hasPropertyExpressions
public boolean hasPropertyExpressions()
- Specified by:
hasPropertyExpressions
in interfaceio.micronaut.core.annotation.AnnotationMetadata
- Specified by:
hasPropertyExpressions
in interfaceio.micronaut.core.annotation.AnnotationMetadataDelegate
- Specified by:
hasPropertyExpressions
in interfaceEnvironmentConfigurable
- Returns:
- Whether any environment specific property expressions exist in the object.
-
getAnnotationMetadata
public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
- Specified by:
getAnnotationMetadata
in interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
configure
public void configure(Environment environment)
Description copied from interface:EnvironmentConfigurable
Configure the component for the given environment.- Specified by:
configure
in interfaceEnvironmentConfigurable
- Parameters:
environment
- The environment
-
equals
public boolean equals(java.lang.Object o)
-
hashCode
public int hashCode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getReturnType
public io.micronaut.core.type.ReturnType getReturnType()
- Specified by:
getReturnType
in interfaceMethodReference
- Returns:
- Return the return type
-
getArgumentTypes
public java.lang.Class[] getArgumentTypes()
- Specified by:
getArgumentTypes
in interfaceMethodReference
- Returns:
- The argument types
-
getDeclaringType
public java.lang.Class getDeclaringType()
- Specified by:
getDeclaringType
in interfaceio.micronaut.core.type.Executable
- Specified by:
getDeclaringType
in interfaceMethodReference
- Returns:
- The bean that declares this injection point
-
getMethodName
public java.lang.String getMethodName()
- Specified by:
getMethodName
in interfaceMethodReference
- Returns:
- The name of the method
-
invoke
public final java.lang.Object invoke(java.lang.Object instance, java.lang.Object... arguments)
- Specified by:
invoke
in interfaceio.micronaut.core.type.Executable
-
invokeInternal
protected abstract java.lang.Object invokeInternal(java.lang.Object instance, java.lang.Object[] arguments)
- Parameters:
instance
- The instancearguments
- The arguments- Returns:
- The result
-
resolveAnnotationMetadata
protected io.micronaut.core.annotation.AnnotationMetadata resolveAnnotationMetadata()
Resolves the annotation metadata for this method. Subclasses- Returns:
- The
AnnotationMetadata
-
getArguments
public io.micronaut.core.type.Argument<?>[] getArguments()
- Specified by:
getArguments
in interfaceio.micronaut.core.type.Executable
-
getTargetMethod
public final java.lang.reflect.Method getTargetMethod()
Soft resolves the targetMethod
avoiding reflection until as late as possible.- Returns:
- The method
- Throws:
java.lang.NoSuchMethodError
- if the method doesn't exist
-
resolveTargetMethod
@NonNull protected java.lang.reflect.Method resolveTargetMethod()
Resolves the target method.- Returns:
- The target method
-
-