MethodHandleDesc — 메서드 핸들 기술자

MethodHandleDesc — 메서드 핸들 기술자

MethodHandleDescMethodHandle 상수에 대한 명목 기술자입니다.

출처: Java API Reference

본문

public sealed interface MethodHandleDesc extends ConstantDesc
    permits DirectMethodHandleDesc (not exhaustive)

팩토리 메서드

static DirectMethodHandleDesc of(DirectMethodHandleDesc.Kind kind, ClassDesc owner, String name, String lookupDescriptor)
static DirectMethodHandleDesc ofMethod(DirectMethodHandleDesc.Kind kind, ClassDesc owner, String name, MethodTypeDesc lookupMethodType)
static DirectMethodHandleDesc ofField(DirectMethodHandleDesc.Kind kind, ClassDesc owner, String fieldName, ClassDesc fieldType)
static DirectMethodHandleDesc ofConstructor(ClassDesc owner, ClassDesc... paramTypes)
  • of 계열 메서드는 메서드, 필드, 생성자를 참조하는 직접 메서드 핸들 기술자를 생성합니다.
  • kindREF_invokeStatic 같은 리플렉션 참조 종류를 나타냅니다.

주요 메서드

default MethodHandleDesc asType(MethodTypeDesc type)
MethodTypeDesc invocationType()
MethodHandle resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException
boolean equals(Object o)
  • invocationType()은 이 메서드 핸들의 호출 타입을 반환합니다.
  • asType은 호출 타입을 조정한 기술자를 만들며, 메서드 핸들의 asType에 해당합니다.
  • resolveConstantDesc는 이 기술자를 실제 MethodHandle로 해석합니다.

더 알아보기 (Learn more)