Record Class AnnotatedMethodHandle<T>
java.lang.Object
java.lang.Record
com.thewinterframework.utils.reflect.AnnotatedMethodHandle<T>
- Type Parameters:
T- The annotation type.
public record AnnotatedMethodHandle<T>(Method reflect, MethodHandle handle, T annotation, List<com.google.inject.Key<?>> parameters)
extends Record
Represents a method handle annotated with a specific annotation.
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotatedMethodHandle(Method reflect, MethodHandle handle, T annotation, List<com.google.inject.Key<?>> parameters) Creates an instance of aAnnotatedMethodHandlerecord class. -
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
AnnotatedMethodHandle<A> annotatedWith(Class<A> annotationType) Returns an AnnotatedMethodHandle for the specified annotation type.Returns the value of theannotationrecord component.final booleanIndicates whether some other object is "equal to" this one.handle()Returns the value of thehandlerecord component.final inthashCode()Returns a hash code value for this object.voidInvokes the method handle with the given parameters.List<com.google.inject.Key<?>> Returns the value of theparametersrecord component.reflect()Returns the value of thereflectrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
AnnotatedMethodHandle
public AnnotatedMethodHandle(Method reflect, MethodHandle handle, T annotation, List<com.google.inject.Key<?>> parameters) Creates an instance of aAnnotatedMethodHandlerecord class.- Parameters:
reflect- the value for thereflectrecord componenthandle- the value for thehandlerecord componentannotation- the value for theannotationrecord componentparameters- the value for theparametersrecord component
-
-
Method Details
-
invoke
Invokes the method handle with the given parameters.- Parameters:
clazz- The class to invoke the method on.injector- The injector to get the instances from.- Throws:
Throwable- If an error occurs while invoking the method.
-
annotatedWith
Returns an AnnotatedMethodHandle for the specified annotation type.- Type Parameters:
A- The type of the annotation.- Parameters:
annotationType- The annotation type to retrieve.- Returns:
- An AnnotatedMethodHandle for the specified annotation type.
- Throws:
IllegalArgumentException- If the method is not annotated with the specified annotation type.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
reflect
Returns the value of thereflectrecord component.- Returns:
- the value of the
reflectrecord component
-
handle
Returns the value of thehandlerecord component.- Returns:
- the value of the
handlerecord component
-
annotation
Returns the value of theannotationrecord component.- Returns:
- the value of the
annotationrecord component
-
parameters
Returns the value of theparametersrecord component.- Returns:
- the value of the
parametersrecord component
-