APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.dynalink.beans

pack-priv abstract Class SingleDynamicMethod

extends DynamicMethod
Class Inheritance
Known Direct Subclasses
jdk.dynalink.beans.CallerSensitiveDynamicMethod, jdk.dynalink.beans.SimpleDynamicMethod
Imports
java.lang.invoke.MethodHandle, .MethodHandles, .MethodType, java.lang.reflect.Array, java.util.StringTokenizer, jdk.dynalink.CallSiteDescriptor, jdk.dynalink.linker.LinkerServices, jdk.dynalink.linker.support.Guards, .Lookup

Base class for dynamic methods that dispatch to a single target Java method or constructor. Handles adaptation of the target method to a call site type (including mapping variable arity methods to a call site signature with different arity).

Field Summary

Modifier and TypeField and Description
private static final MethodHandle

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static boolean
canConvertTo(final LinkerServices linkerServices, final Class<?> to, final Object obj)

pack-priv static MethodHandle

Returns:

a collecting method handle
collectArguments
(final MethodHandle
the original method handle
target
,
final int
the total number of arguments in the new method handle
parameterCount
)

Creates a method handle out of the original target that will collect the varargs for the exact component type of the varArg array.

pack-priv boolean
contains(final SingleDynamicMethod method)

Implements abstract jdk.dynalink.beans.DynamicMethod.contains.

True if this dynamic method already contains a method with an identical signature as the passed in method.

private static MethodHandle
createConvertingInvocation(final MethodHandle sizedMethod, final LinkerServices linkerServices, final MethodType callSiteType)

pack-priv MethodHandle
getInvocation(final CallSiteDescriptor callSiteDescriptor, final LinkerServices linkerServices)

Implements abstract jdk.dynalink.beans.DynamicMethod.getInvocation.

Creates an invocation for the dynamic method.

pack-priv static MethodHandle

Returns:

the adapted method handle.
getInvocation
(final MethodHandle
the method handle to adapt
target
,
final MethodType
the type of the call site
callSiteType
,
final LinkerServices
the linker services used for type conversions
linkerServices
)

Given a method handle and a call site type, adapts the method handle to the call site type.

pack-priv SingleDynamicMethod
getMethodForExactParamTypes(final String paramTypes)

Implements abstract jdk.dynalink.beans.DynamicMethod.getMethodForExactParamTypes.

Returns a single dynamic method representing a single underlying Java method (possibly selected among several overloads) with formal parameter types exactly matching the passed signature.

pack-priv static String
getMethodNameWithSignature(final MethodType type, final String methodName, final boolean withReturnType)

pack-priv abstract MethodType

Returns:

this method's native type.
getMethodType
()

Returns this method's native type.

pack-priv abstract MethodHandle

Returns:

the handle to this method's target method.
getTarget
(CallSiteDescriptor
the call site descriptor to use.
desc
)

Given a specified call site descriptor, returns a method handle to this method's target.

pack-priv abstract boolean

Returns:

true if this method is variable arity.
isVarArgs
()

Returns true if this method is variable arity.

private static boolean
typeMatchesDescription(final String paramTypes, final MethodType type)

private static boolean
typeNameMatches(final String typeName, final Class<?> type)

Inherited from jdk.dynalink.beans.DynamicMethod:
getClassAndMethodNamegetNameisConstructortoString

Field Detail

CAN_CONVERT_TOback to summary
private static final MethodHandle CAN_CONVERT_TO

Constructor Detail

SingleDynamicMethodback to summary
pack-priv SingleDynamicMethod(final String name)

Method Detail

canConvertToback to summary
private static boolean canConvertTo(final LinkerServices linkerServices, final Class<?> to, final Object obj)
Annotations
@SuppressWarnings:unused
collectArgumentsback to summary
pack-priv static MethodHandle collectArguments(final MethodHandle target, final int parameterCount)

Creates a method handle out of the original target that will collect the varargs for the exact component type of the varArg array. Note that this will nicely trigger language-specific type converters for exactly those varargs for which it is necessary when later passed to linkerServices.convertArguments().

Parameters
target:MethodHandle

the original method handle

parameterCount:int

the total number of arguments in the new method handle

Returns:MethodHandle

a collecting method handle

containsback to summary
pack-priv boolean contains(final SingleDynamicMethod method)

Implements abstract jdk.dynalink.beans.DynamicMethod.contains.

Doc from jdk.dynalink.beans.DynamicMethod.contains.

True if this dynamic method already contains a method with an identical signature as the passed in method.

Annotations
@Override
createConvertingInvocationback to summary
private static MethodHandle createConvertingInvocation(final MethodHandle sizedMethod, final LinkerServices linkerServices, final MethodType callSiteType)
getInvocationback to summary
pack-priv MethodHandle getInvocation(final CallSiteDescriptor callSiteDescriptor, final LinkerServices linkerServices)

Implements abstract jdk.dynalink.beans.DynamicMethod.getInvocation.

Doc from jdk.dynalink.beans.DynamicMethod.getInvocation.

Creates an invocation for the dynamic method. If the method is overloaded, it will perform overloaded method resolution based on the specified method type. The resulting resolution can either identify a single method to be invoked among the overloads, or it can identify multiple ones. In the latter case, the returned method handle will perform further overload resolution among these candidates at every invocation. If the method to be invoked is a variable arguments (vararg) method, it will pack the extra arguments in an array before the invocation of the underlying method if it is not already done.

Annotations
@Override
getInvocationback to summary
pack-priv static MethodHandle getInvocation(final MethodHandle target, final MethodType callSiteType, final LinkerServices linkerServices)

Given a method handle and a call site type, adapts the method handle to the call site type. Performs type conversions as needed using the specified linker services, and in case that the method handle is a vararg collector, matches it to the arity of the call site. The type of the return value is only changed if it can be converted using a conversion that loses neither precision nor magnitude, see LinkerServices#asTypeLosslessReturn(MethodHandle, MethodType).

Parameters
target:MethodHandle

the method handle to adapt

callSiteType:MethodType

the type of the call site

linkerServices:LinkerServices

the linker services used for type conversions

Returns:MethodHandle

the adapted method handle.

getMethodForExactParamTypesback to summary
pack-priv SingleDynamicMethod getMethodForExactParamTypes(final String paramTypes)

Implements abstract jdk.dynalink.beans.DynamicMethod.getMethodForExactParamTypes.

Doc from jdk.dynalink.beans.DynamicMethod.getMethodForExactParamTypes.

Returns a single dynamic method representing a single underlying Java method (possibly selected among several overloads) with formal parameter types exactly matching the passed signature.

Annotations
@Override
getMethodNameWithSignatureback to summary
pack-priv static String getMethodNameWithSignature(final MethodType type, final String methodName, final boolean withReturnType)
getMethodTypeback to summary
pack-priv abstract MethodType getMethodType()

Returns this method's native type.

Returns:MethodType

this method's native type.

getTargetback to summary
pack-priv abstract MethodHandle getTarget(CallSiteDescriptor desc)

Given a specified call site descriptor, returns a method handle to this method's target. The target should only depend on the descriptor's lookup, and it should only retrieve it (as a privileged operation) when it is absolutely needed.

Parameters
desc:CallSiteDescriptor

the call site descriptor to use.

Returns:MethodHandle

the handle to this method's target method.

isVarArgsback to summary
pack-priv abstract boolean isVarArgs()

Returns true if this method is variable arity.

Returns:boolean

true if this method is variable arity.

typeMatchesDescriptionback to summary
private static boolean typeMatchesDescription(final String paramTypes, final MethodType type)
typeNameMatchesback to summary
private static boolean typeNameMatches(final String typeName, final Class<?> type)