Top Description Fields Constructors Methods
jdk.dynalink.beans

pack-priv Class OverloadedDynamicMethod

extends DynamicMethod
Class Inheritance
Imports
java.lang.invoke.MethodHandle, .MethodType, java.security.AccessControlContext, .AccessController, .PrivilegedAction, java.text.Collator, java.util.ArrayList, .IdentityHashMap, .LinkedList, .List, .Map, .Set, jdk.dynalink.CallSiteDescriptor, .SecureLookupSupplier, jdk.dynalink.beans.ApplicableOverloadedMethods.ApplicabilityTest, jdk.dynalink.internal.AccessControlContextFactory, .InternalTypeUtilities, jdk.dynalink.linker.LinkerServices

Represents a group of SingleDynamicMethod objects that represents all overloads of a particular name (or all constructors) for a particular class. Correctly handles overload resolution, variable arity methods, and caller sensitive methods within the overloads.

Field Summary

Modifier and TypeField and Description
private static final AccessControlContext
GET_CALL_SITE_CLASS_LOADER_CONTEXT

References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
private final LinkedList<SingleDynamicMethod>
methods

Holds a list of all methods.

private static final Set<Class<?>>

Constructor Summary

AccessConstructor and Description
pack-priv
OverloadedDynamicMethod(final Class<?>
the class this method belongs to
clazz
,
final String
the name of the method
name
)

Creates a new overloaded dynamic method.

Method Summary

Modifier and TypeMethod and Description
private static void
addClassHierarchy(final Map<Class<?>, Class<?>> map, final Class<?> clazz)

public void
addMethod(final SingleDynamicMethod
a method to add
method
)

Add a method to this overloaded method's set.

private boolean
public boolean
contains(final SingleDynamicMethod
the method to check
m
)

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 Set<Class<?>>
private ApplicableOverloadedMethods
private static ClassLoader
getCallSiteClassLoader(final CallSiteDescriptor callSiteDescriptor)

pack-priv MethodHandle
getInvocation(final CallSiteDescriptor
the descriptor of the call site
callSiteDescriptor
,
final LinkerServices
linker services. Used for language-specific type conversions.
linkerServices
)

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

Creates an invocation for the dynamic method.

pack-priv SingleDynamicMethod
getMethodForExactParamTypes(final String
the comma-separated list of requested parameter type names. The names will match both qualified and unqualified type names.
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.

private static boolean
isApplicableDynamically(final LinkerServices linkerServices, final MethodType callSiteType, final SingleDynamicMethod m)

private static boolean
isApplicableDynamically(final LinkerServices linkerServices, final Class<?> callSiteType, final Class<?> methodType)

private static boolean

Returns:

true if the class can be assigned from any boxed primitive. Basically, it is true if the class is any primitive wrapper class, or a superclass or superinterface of any primitive wrapper class.
isAssignableFromBoxedPrimitive
(final Class<?>
the class
clazz
)

Returns true if the class can be assigned from any boxed primitive.

public boolean
isConstructor()

Overrides jdk.dynalink.beans.DynamicMethod.isConstructor.

True if this method happens to be a constructor method.

private static boolean

Returns:

true if callSiteType is potentially convertible to the methodType.
isPotentiallyConvertible
(final Class<?>
the parameter type at the call site
callSiteType
,
final Class<?>
the parameter type in the method declaration
methodType
)

Determines whether one type can be potentially converted to another type at runtime.

public String
toString()

Overrides jdk.dynalink.beans.DynamicMethod.toString.

Returns a string representation of the object.

Inherited from jdk.dynalink.beans.DynamicMethod:
getClassAndMethodNamegetName

Field Detail

GET_CALL_SITE_CLASS_LOADER_CONTEXTback to summary
private static final AccessControlContext GET_CALL_SITE_CLASS_LOADER_CONTEXT

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Annotations
@SuppressWarnings:removal
methodsback to summary
private final LinkedList<SingleDynamicMethod> methods

Holds a list of all methods.

PRIMITIVE_WRAPPER_TYPESback to summary
private static final Set<Class<?>> PRIMITIVE_WRAPPER_TYPES

Constructor Detail

OverloadedDynamicMethodback to summary
pack-priv OverloadedDynamicMethod(final Class<?> clazz, final String name)

Creates a new overloaded dynamic method.

Parameters
clazz:Class<?>

the class this method belongs to

name:String

the name of the method

Method Detail

addClassHierarchyback to summary
private static void addClassHierarchy(final Map<Class<?>, Class<?>> map, final Class<?> clazz)
addMethodback to summary
public void addMethod(final SingleDynamicMethod method)

Add a method to this overloaded method's set.

Parameters
method:SingleDynamicMethod

a method to add

constructorFlagConsistentback to summary
private boolean constructorFlagConsistent(final SingleDynamicMethod method)
containsback to summary
public boolean contains(final SingleDynamicMethod m)

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.

Parameters
m:SingleDynamicMethod

the method to check

Returns:boolean

true if it already contains an equivalent method.

Annotations
@Override
createPrimitiveWrapperTypesback to summary
private static Set<Class<?>> createPrimitiveWrapperTypes()
getApplicablesback to summary
private ApplicableOverloadedMethods getApplicables(final MethodType callSiteType, final ApplicableOverloadedMethods.ApplicabilityTest test)
getCallSiteClassLoaderback to summary
private static ClassLoader getCallSiteClassLoader(final CallSiteDescriptor callSiteDescriptor)
Annotations
@SuppressWarnings:removal
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.

Parameters
callSiteDescriptor:CallSiteDescriptor

the descriptor of the call site

linkerServices:LinkerServices

linker services. Used for language-specific type conversions.

Returns:MethodHandle

an invocation suitable for calling the method from the specified call site.

Annotations
@Override
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.

Parameters
paramTypes:String

the comma-separated list of requested parameter type names. The names will match both qualified and unqualified type names.

Returns:SingleDynamicMethod

a single dynamic method representing a single underlying Java method, or null if none of the Java methods behind this dynamic method exactly match the requested parameter types.

Annotations
@Override
isApplicableDynamicallyback to summary
private static boolean isApplicableDynamically(final LinkerServices linkerServices, final MethodType callSiteType, final SingleDynamicMethod m)
isApplicableDynamicallyback to summary
private static boolean isApplicableDynamically(final LinkerServices linkerServices, final Class<?> callSiteType, final Class<?> methodType)
isAssignableFromBoxedPrimitiveback to summary
private static boolean isAssignableFromBoxedPrimitive(final Class<?> clazz)

Returns true if the class can be assigned from any boxed primitive.

Parameters
clazz:Class<?>

the class

Returns:boolean

true if the class can be assigned from any boxed primitive. Basically, it is true if the class is any primitive wrapper class, or a superclass or superinterface of any primitive wrapper class.

isConstructorback to summary
public boolean isConstructor()

Overrides jdk.dynalink.beans.DynamicMethod.isConstructor.

Doc from jdk.dynalink.beans.DynamicMethod.isConstructor.

True if this method happens to be a constructor method.

Returns:boolean

true if this represents a constructor.

Annotations
@Override
isPotentiallyConvertibleback to summary
private static boolean isPotentiallyConvertible(final Class<?> callSiteType, final Class<?> methodType)

Determines whether one type can be potentially converted to another type at runtime. Allows a conversion between any subtype and supertype in either direction, and also allows a conversion between any two primitive types, as well as between any primitive type and any reference type that can hold a boxed primitive.

Parameters
callSiteType:Class<?>

the parameter type at the call site

methodType:Class<?>

the parameter type in the method declaration

Returns:boolean

true if callSiteType is potentially convertible to the methodType.

toStringback to summary
public String toString()

Overrides jdk.dynalink.beans.DynamicMethod.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override