Module org.elasticsearch.server
Package org.elasticsearch.injection.spec
Record Class MethodHandleSpec
java.lang.Object
java.lang.Record
org.elasticsearch.injection.spec.MethodHandleSpec
- All Implemented Interfaces:
InjectionSpec
public record MethodHandleSpec(Class<?> requestedType, MethodHandle methodHandle, List<ParameterSpec> parameters)
extends Record
implements InjectionSpec
Indicates that a type should be instantiated by calling the given
MethodHandle
.
Design note: the intent is that the semantics are fully specified by this record, and no additional reflection logic is required to determine how the object should be injected. Roughly speaking: all the reflection should be finished, and the results should be stored in this object.
-
Constructor Summary
ConstructorsConstructorDescriptionMethodHandleSpec
(Class<?> requestedType, MethodHandle methodHandle, List<ParameterSpec> parameters) Creates an instance of aMethodHandleSpec
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of themethodHandle
record component.Returns the value of theparameters
record component.Class<?>
Returns the value of therequestedType
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
MethodHandleSpec
public MethodHandleSpec(Class<?> requestedType, MethodHandle methodHandle, List<ParameterSpec> parameters) Creates an instance of aMethodHandleSpec
record class.- Parameters:
requestedType
- the value for therequestedType
record componentmethodHandle
- the value for themethodHandle
record componentparameters
- the value for theparameters
record component
-
-
Method Details
-
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)
. -
requestedType
Returns the value of therequestedType
record component.- Specified by:
requestedType
in interfaceInjectionSpec
- Returns:
- the value of the
requestedType
record component
-
methodHandle
Returns the value of themethodHandle
record component.- Returns:
- the value of the
methodHandle
record component
-
parameters
Returns the value of theparameters
record component.- Returns:
- the value of the
parameters
record component
-