Class InvokerUtils
java.lang.Object
org.eclipse.jetty.websocket.core.util.InvokerUtils
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classstatic interface
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic MethodHandlebindTo(MethodHandle methodHandle, Object... objs) Bind optional arguments to provided method handlestatic MethodHandlemutatedInvoker(MethodHandles.Lookup lookup, Class<?> targetClass, Method method, InvokerUtils.Arg... callingArgs) Build a MethodHandle that can call the method with the calling args provided.static MethodHandlemutatedInvoker(MethodHandles.Lookup lookup, Class<?> targetClass, Method method, InvokerUtils.ParamIdentifier paramIdentifier, String[] namedVariables, InvokerUtils.Arg... callingArgs) Create a MethodHandle that performs the following layersMethodHandles.permuteArguments(MethodHandle, MethodType, int...)- moving calling Args around to fit actual actual method parameter arguments (in proper order), with remaining (unused) calling args afterwordsMethodHandles.dropArguments(MethodHandle, int, Class[])- to drop the unused calling argsMethodHandle.invoke(Object...)- to call the specific methodstatic MethodHandleoptionalMutatedInvoker(MethodHandles.Lookup lookup, Class<?> targetClass, Method method, InvokerUtils.Arg... callingArgs) static MethodHandleoptionalMutatedInvoker(MethodHandles.Lookup lookup, Class<?> targetClass, Method method, InvokerUtils.ParamIdentifier paramIdentifier, String[] namedVariables, InvokerUtils.Arg... callingArgs) Create an optional MethodHandle that performs the following layers.
- 
Field Details- 
PARAM_IDENTITY
 
- 
- 
Constructor Details- 
InvokerUtilspublic InvokerUtils()
 
- 
- 
Method Details- 
bindToBind optional arguments to provided method handle- Parameters:
- methodHandle- the method handle to bind to
- objs- the list of optional objects to bind to.
- Returns:
- the bound MethodHandle, or null if the provided methodHandlewas null.
 
- 
mutatedInvokerpublic static MethodHandle mutatedInvoker(MethodHandles.Lookup lookup, Class<?> targetClass, Method method, InvokerUtils.Arg... callingArgs) Build a MethodHandle that can call the method with the calling args provided.Might need to drop calling args and/or reorder the calling args to fit the actual method being called. - Parameters:
- lookup- the- MethodHandles.Lookupinstance to use.
- targetClass- the target class for invocations of the resulting MethodHandle (also known as parameter 0)
- method- the method to invoke
- callingArgs- the calling arguments. This is the array of arguments that will always be passed into the returned MethodHandle. They will be present in the- MethodHandle.type()in the order specified in this array.
 
- 
mutatedInvokerpublic static MethodHandle mutatedInvoker(MethodHandles.Lookup lookup, Class<?> targetClass, Method method, InvokerUtils.ParamIdentifier paramIdentifier, String[] namedVariables, InvokerUtils.Arg... callingArgs) Create a MethodHandle that performs the following layers- MethodHandles.permuteArguments(MethodHandle, MethodType, int...)- moving calling Args around to fit actual actual method parameter arguments (in proper order), with remaining (unused) calling args afterwords
- MethodHandles.dropArguments(MethodHandle, int, Class[])- to drop the unused calling args
- MethodHandle.invoke(Object...)- to call the specific method
 The returned MethodHandle.MethodHandle.type()assumes the following:- Return type will be what the provided Methodhas.
- The first parameter is the type of class provided in the targetClass.
- The next parameters are all of the found type's of the named arguments, or type Stringif not found in providedMethod.
- The next parameters are all of the provided callingArgtypes
 - Parameters:
- lookup- the- MethodHandles.Lookupinstance to use.
- targetClass- the target class for invocations of the resulting MethodHandle (also known as parameter 0)
- method- the method to invoke
- paramIdentifier- the mechanism to identify parameters in method
- namedVariables- the array of named variables. This is the array of named arguments that the target method might have. The resulting MethodHandle will include all of these namedVariables as the first non-object arguments in the- MethodTypefound on the returned- MethodHandle.type()
- callingArgs- the calling arguments. This is the array of arguments that will always be passed into the returned MethodHandle. They will be present in the- MethodHandle.type()in the order specified in this array.
- Returns:
- the MethodHandle for this set of CallingArgs
- Throws:
- RuntimeException- when unable to fit Calling Args to Parameter Types
 
- 
optionalMutatedInvokerpublic static MethodHandle optionalMutatedInvoker(MethodHandles.Lookup lookup, Class<?> targetClass, Method method, InvokerUtils.ParamIdentifier paramIdentifier, String[] namedVariables, InvokerUtils.Arg... callingArgs) Create an optional MethodHandle that performs the following layers.- MethodHandles.permuteArguments(MethodHandle, MethodType, int...)- moving calling Args around to fit actual actual method parameter arguments (in proper order), with remaining (unused) calling args afterwords
- MethodHandles.dropArguments(MethodHandle, int, Class[])- to drop the unused calling args
- MethodHandle.invoke(Object...)- to call the specific method
 - Parameters:
- lookup- the- MethodHandles.Lookupinstance to use.
- targetClass- the target class for invocations of the resulting MethodHandle (also known as parameter 0)
- method- the method to invoke
- paramIdentifier- the mechanism to identify parameters in method
- namedVariables- the array of named variables. This is the array of named arguments that the target method might have. The resulting MethodHandle will include all of these namedVariables as the first non-object arguments in the- MethodTypefound on the returned- MethodHandle.type()
- callingArgs- the calling arguments. This is the array of arguments that will always be passed into the returned MethodHandle. They will be present in the- MethodHandle.type()in the order specified in this array.
- Returns:
- the MethodHandle for this set of CallingArgs, or null if not possible to create MethodHandle with CallingArgs to provided method
 
- 
optionalMutatedInvokerpublic static MethodHandle optionalMutatedInvoker(MethodHandles.Lookup lookup, Class<?> targetClass, Method method, InvokerUtils.Arg... callingArgs) 
 
-