Package io.micronaut.context
Class AbstractExecutableMethod
java.lang.Object
io.micronaut.context.AbstractExecutableMethod
- All Implemented Interfaces:
EnvironmentConfigurable
,AnnotatedElement
,AnnotationMetadata
,AnnotationMetadataDelegate
,AnnotationMetadataProvider
,AnnotationSource
,Described
,Named
,Executable
,UnsafeExecutable
,ExecutableMethod
,MethodReference
@Internal
public abstract class AbstractExecutableMethod
extends Object
implements UnsafeExecutable, ExecutableMethod, EnvironmentConfigurable
Abstract base class for generated ExecutableMethod
classes to implement. The generated classes should
implement the Executable.invoke(Object, Object...)
method at compile time providing direct dispatch
of the target method
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Class<?>[]
protected final Class<?>
protected final String
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractExecutableMethod
(Class<?> declaringType, String methodName) protected
AbstractExecutableMethod
(Class<?> declaringType, String methodName, Argument genericReturnType) protected
AbstractExecutableMethod
(Class<?> declaringType, String methodName, Argument genericReturnType, Argument... arguments) -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Environment environment) Configure the component for the given environment.boolean
Supplies the metadata.Argument<?>[]
The required argument types.Class<?>[]
Class<?>
final Method
Soft resolves the targetMethod
avoiding reflection until as late as possible.int
hashCode()
boolean
Does the metadata contain any property expressions like${foo.bar}
.final Object
Invokes the method.protected abstract Object
invokeInternal
(Object instance, Object[] arguments) invokeUnsafe
(Object instance, Object... arguments) Invokes the method without the arguments' validation.protected AnnotationMetadata
Resolves the annotation metadata for this method.Resolves the target method.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
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresent
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, 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, 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.core.type.Executable
getArguments
Methods inherited from interface io.micronaut.inject.ExecutableMethod
getDescription, getDescription, isAbstract, isSuspend
Methods inherited from interface io.micronaut.inject.MethodReference
getArgumentNames, getArguments, getName, getTargetMethod
-
Field Details
-
declaringType
-
methodName
-
argTypes
-
-
Constructor Details
-
AbstractExecutableMethod
protected AbstractExecutableMethod(Class<?> declaringType, String methodName, Argument genericReturnType, Argument... arguments) - Parameters:
declaringType
- The declaring typemethodName
- The method namegenericReturnType
- The generic return typearguments
- The arguments
-
AbstractExecutableMethod
protected AbstractExecutableMethod(Class<?> declaringType, String methodName, Argument genericReturnType) - Parameters:
declaringType
- The declaring typemethodName
- The method namegenericReturnType
- The generic return type
-
AbstractExecutableMethod
- Parameters:
declaringType
- The declaring typemethodName
- The method name
-
-
Method Details
-
hasPropertyExpressions
public boolean hasPropertyExpressions()Description copied from interface:AnnotationMetadata
Does the metadata contain any property expressions like${foo.bar}
. Note this by default returnstrue
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.- Specified by:
hasPropertyExpressions
in interfaceAnnotationMetadata
- Specified by:
hasPropertyExpressions
in interfaceAnnotationMetadataDelegate
- Specified by:
hasPropertyExpressions
in interfaceEnvironmentConfigurable
- Returns:
- True if property expressions are present
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProvider
Supplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA
.- Specified by:
getAnnotationMetadata
in interfaceAnnotationMetadataProvider
- Returns:
- The
AnnotationMetadata
-
configure
Description copied from interface:EnvironmentConfigurable
Configure the component for the given environment.- Specified by:
configure
in interfaceEnvironmentConfigurable
- Parameters:
environment
- The environment
-
equals
-
hashCode
public int hashCode() -
toString
-
getReturnType
- Specified by:
getReturnType
in interfaceMethodReference
- Returns:
- Return the return type
-
getArgumentTypes
- Specified by:
getArgumentTypes
in interfaceMethodReference
- Returns:
- The argument types
-
getDeclaringType
- Specified by:
getDeclaringType
in interfaceExecutable
- Specified by:
getDeclaringType
in interfaceMethodReference
- Returns:
- The declaring type
-
getMethodName
- Specified by:
getMethodName
in interfaceMethodReference
- Returns:
- The name of the method
-
invoke
Description copied from interface:Executable
Invokes the method.- Specified by:
invoke
in interfaceExecutable
- Parameters:
instance
- The instance. Nullable only if it's a static method call.arguments
- The arguments- Returns:
- The result
-
invokeUnsafe
Description copied from interface:UnsafeExecutable
Invokes the method without the arguments' validation.- Specified by:
invokeUnsafe
in interfaceUnsafeExecutable
- Parameters:
instance
- The instance. Nullable only if it's a static method call.arguments
- The arguments- Returns:
- The result
-
invokeInternal
- Parameters:
instance
- The instancearguments
- The arguments- Returns:
- The result
-
resolveAnnotationMetadata
Resolves the annotation metadata for this method. Subclasses- Returns:
- The
AnnotationMetadata
-
getArguments
Description copied from interface:Executable
The required argument types.- Specified by:
getArguments
in interfaceExecutable
- Returns:
- The arguments
-
getTargetMethod
Soft resolves the targetMethod
avoiding reflection until as late as possible.- Returns:
- The method
- Throws:
NoSuchMethodError
- if the method doesn't exist
-
resolveTargetMethod
Resolves the target method.- Returns:
- The target method
-