Class ReflectionExecutableMethod<T,R>
java.lang.Object
io.micronaut.reflection.ReflectionExecutableMethod<T,R>
- Type Parameters:
T- The declaring typeR- The return type
- All Implemented Interfaces:
EnvironmentConfigurable, AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, Executable<T,R>, UnsafeExecutable<T, R>, ExecutableMethod<T, R>, MethodReference<T, R>
public final class ReflectionExecutableMethod<T,R>
extends Object
implements EnvironmentConfigurable
An
ExecutableMethod over a Method, with the arguments, the return type
and the annotation metadata a generated executable method would have.- Since:
- 5.2.0
- Author:
- Denis Stepanov
-
Field Summary
Fields inherited from interface AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBERFields inherited from interface AnnotationSource
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionReflectionExecutableMethod(Class<T> declaringType, Method method) Creates an executable method over a method. -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Environment environment) Configure the component for the given environment.booleanSupplies the metadata.Argument<?>[]The required argument types.Class<?>[]The method this executable method invokes.inthashCode()booleanDoes the metadata contain any property expressions like${foo.bar}.final RInvokes the method.@Nullable RinvokeUnsafe(T instance, @Nullable Object... arguments) Invokes the method without the arguments' validation.booleanDefines whether the method is abstract.booleanDefines whether the method is Kotlin suspend function.static <T> ReflectionExecutableMethod<T, Object> The executable method of a method, declared by the given type.static <T> ReflectionExecutableMethod<T, Object> The executable method of a method, declared by the class declaring the method.toString()Methods inherited from interface AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullableMethods inherited from interface AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresentMethods inherited from interface 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, hasEvaluatedExpressions, 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 ExecutableMethod
getDescription, getDescriptionMethods inherited from interface MethodReference
getArgumentNames, getName
-
Constructor Details
-
ReflectionExecutableMethod
-
-
Method Details
-
of
The executable method of a method, declared by the class declaring the method.- Type Parameters:
T- The declaring type- Parameters:
method- The method- Returns:
- The executable method
-
of
The executable method of a method, declared by the given type.- Type Parameters:
T- The declaring type- Parameters:
declaringType- The type the method is invoked on, which may inherit the methodmethod- The method- Returns:
- The executable method
-
getMethod
-
getTargetMethod
- Specified by:
getTargetMethodin interfaceMethodReference<T,R> - Returns:
- The target method
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProviderSupplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA.- Specified by:
getAnnotationMetadatain interfaceAnnotationMetadataProvider- Returns:
- The
AnnotationMetadata
-
isAbstract
public boolean isAbstract()Description copied from interface:ExecutableMethodDefines whether the method is abstract.- Specified by:
isAbstractin interfaceExecutableMethod<T,R> - Returns:
- Is the method abstract.
-
isSuspend
public boolean isSuspend()Description copied from interface:ExecutableMethodDefines whether the method is Kotlin suspend function.- Specified by:
isSuspendin interfaceExecutableMethod<T,R> - Returns:
- Is the method Kotlin suspend function.
-
hasPropertyExpressions
public boolean hasPropertyExpressions()Description copied from interface:AnnotationMetadataDoes the metadata contain any property expressions like${foo.bar}. Note this by default returnstrueas 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:
hasPropertyExpressionsin interfaceAnnotationMetadata- Specified by:
hasPropertyExpressionsin interfaceAnnotationMetadataDelegate- Specified by:
hasPropertyExpressionsin interfaceEnvironmentConfigurable- Returns:
- True if property expressions are present
-
configure
Description copied from interface:EnvironmentConfigurableConfigure the component for the given environment.- Specified by:
configurein interfaceEnvironmentConfigurable- Parameters:
environment- The environment
-
invokeUnsafe
Description copied from interface:UnsafeExecutableInvokes the method without the arguments' validation.- Specified by:
invokeUnsafein interfaceUnsafeExecutable<T,R> - Parameters:
instance- The instance. Nullable only if it's a static method call.arguments- The arguments- Returns:
- The result
-
equals
-
hashCode
public int hashCode() -
getDeclaringType
- Specified by:
getDeclaringTypein interfaceExecutable<T,R> - Specified by:
getDeclaringTypein interfaceMethodReference<T,R> - Returns:
- The declaring type
-
getMethodName
- Specified by:
getMethodNamein interfaceMethodReference<T,R> - Returns:
- The name of the method
-
getArguments
Description copied from interface:ExecutableThe required argument types.- Specified by:
getArgumentsin interfaceExecutable<T,R> - Specified by:
getArgumentsin interfaceMethodReference<T,R> - Returns:
- The arguments
-
getArgumentTypes
- Specified by:
getArgumentTypesin interfaceMethodReference<T,R> - Returns:
- The argument types
-
getReturnType
- Specified by:
getReturnTypein interfaceMethodReference<T,R> - Returns:
- Return the return type
-
invoke
Description copied from interface:ExecutableInvokes the method.- Specified by:
invokein interfaceExecutable<T,R> - Parameters:
instance- The instance. Nullable only if it's a static method call.arguments- The arguments- Returns:
- The result
-
toString
-