- All Superinterfaces:
ConstantDesc
,MethodHandleDesc
A nominal descriptor for a direct
MethodHandle
. A DirectMethodHandleDesc corresponds to
a Constant_MethodHandle_info
entry in the constant pool of a classfile.- API Note:
- In the future, if the Java language permits, DirectMethodHandleDesc
may become a
sealed
interface, which would prohibit subclassing except by explicitly permitted types. Non-platform classes should not implement DirectMethodHandleDesc directly. - Since:
- 12
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Kinds of method handles that can be described with DirectMethodHandleDesc. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates if the method is declared by an interfacekind()
Returns thekind
of the method handle described by this nominal descriptor.Returns the lookup descriptor of the method handle described by this descriptor, after adjusting for the invocation mode.Returns the name of the method or field described by this nominal descriptor.owner()
Returns aClassDesc
describing the class declaring the method or field described by this nominal descriptor.int
refKind()
Returns therefKind
of the method handle described by this nominal reference, as defined byMethodHandleInfo
.Methods declared in interface java.lang.constant.ConstantDesc
resolveConstantDesc
Methods declared in interface java.lang.constant.MethodHandleDesc
asType, equals, invocationType
-
Method Details
-
kind
DirectMethodHandleDesc.Kind kind()Returns thekind
of the method handle described by this nominal descriptor.- Returns:
- the
DirectMethodHandleDesc.Kind
-
refKind
int refKind()Returns therefKind
of the method handle described by this nominal reference, as defined byMethodHandleInfo
.- Returns:
- the reference kind
-
isOwnerInterface
boolean isOwnerInterface()Indicates if the method is declared by an interface- Returns:
- true if the method is declared by an interface
-
owner
ClassDesc owner()Returns aClassDesc
describing the class declaring the method or field described by this nominal descriptor.- Returns:
- the class declaring the method or field
-
methodName
String methodName()Returns the name of the method or field described by this nominal descriptor. For constructors, returns the reserved name"<init>"
.- Returns:
- the name of the method or field
-
lookupDescriptor
String lookupDescriptor()Returns the lookup descriptor of the method handle described by this descriptor, after adjusting for the invocation mode. This will correspond to either a method type descriptor string (for methods and constructors), or a field descriptor string (for field access method handles). The lookup descriptor string is in the same format as accepted byMethodHandleDesc.of(Kind, ClassDesc, String, String)
.- Returns:
- the lookup descriptor string
-