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 aMethodHandleSpecrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themethodHandlerecord component.Returns the value of theparametersrecord component.Class<?> Returns the value of therequestedTyperecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MethodHandleSpec
public MethodHandleSpec(Class<?> requestedType, MethodHandle methodHandle, List<ParameterSpec> parameters) Creates an instance of aMethodHandleSpecrecord class.- Parameters:
requestedType- the value for therequestedTyperecord componentmethodHandle- the value for themethodHandlerecord componentparameters- the value for theparametersrecord 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 therequestedTyperecord component.- Specified by:
requestedTypein interfaceInjectionSpec- Returns:
- the value of the
requestedTyperecord component
-
methodHandle
Returns the value of themethodHandlerecord component.- Returns:
- the value of the
methodHandlerecord component
-
parameters
Returns the value of theparametersrecord component.- Returns:
- the value of the
parametersrecord component
-