MethodHandle mh = Binder
.from(String.class, String.class, String.class) // String w(String, String)
.drop(1, String.class) // String x(String)
.insert(0, 'hello') // String y(String, String)
.cast(String.class, CharSequence.class, Object.class) // String z(CharSequence, Object)String
.invoke(someTargetHandle);
| Modifier and Type | Field and Description |
|---|---|
| private static final Logger | |
| private final MethodHandles. | |
| private final MethodType | |
| private final List | |
| private final List |
| Access | Constructor and Description |
|---|---|
| public | Binder(MethodType
the starting MethodType, for calls entering the eventual chain start)Construct a new Binder, starting from a given MethodType. |
| public | Binder(MethodHandles.
the Lookup context to use for direct handles lookup,the starting MethodType, for calls entering the eventual chain start)Construct a new Binder, starting from a given Lookup and MethodType. |
| public | |
| public | Binder(MethodHandles.
the Lookup context to use for direct handles lookup,the source Binder source)Construct a new Binder using the given Lookup and invokebinder. |
| public | |
| public | Binder(Binder
the source Binder source, Transform the additional Transform transform, MethodType the new current type resulting from the transform type)Construct a new Binder using the given invokebinder plus an additional transform and current type |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | add(Transform transform, MethodType target)
Add a Transform with an associated MethodType target to the chain. |
| public Binder | Returns: a new Binderthe value to append value)Append to the argument list the given boolean value. |
| public Binder | Returns: a new Binderthe value to append value)Append to the argument list the given byte value. |
| public Binder | Returns: a new Binderthe value to append value)Append to the argument list the given short value. |
| public Binder | Returns: a new Binderthe value to append value)Append to the argument list the given char value. |
| public Binder | Returns: a new Binderthe value to append value)Append to the argument list the given int value. |
| public Binder | Returns: a new Binderthe value to append value)Append to the argument list the given long value. |
| public Binder | Returns: a new Binderthe value to append value)Append to the argument list the given float value. |
| public Binder | Returns: a new Binderthe value to append value)Append to the argument list the given double value. |
| public Binder | |
| public Binder | |
| public Binder | |
| public Binder | Returns: a new Binderthe value to append values)Append to the argument list the given boolean values. |
| public Binder | Returns: a new Binderthe values to append values)Append to the argument list the given byte values. |
| public Binder | Returns: a new Binderthe values to append values)Append to the argument list the given char values. |
| public Binder | Returns: a new Binderthe values to append values)Append to the argument list the given double values. |
| public Binder | Returns: a new Binderthe values to append values)Append to the argument list the given float values. |
| public Binder | Returns: a new Binderthe values to append values)Append to the argument list the given int values. |
| public Binder | Returns: a new Binderthe values to append values)Append to the argument list the given long values. |
| public Binder | Returns: a new Binderthe values to append values)Append to the argument list the given short values. |
| public Binder | Returns: a new Binderthe value(s) to append typesAndValues)Append to the argument list the given argument type(s) and value(s), provided as (Class, value) pairs of arguments. |
| public MethodHandle | arrayAccess(VarHandle.
Apply the chain of transforms and bind them to an array varhandle operation. |
| public MethodHandle | Returns: the full handle chain, bound to an array element get.Apply the chain of transforms and bind them to an array element get. |
| public MethodHandle | arrayGetAcquire()
Apply the chain of transforms and bind them to an acquire-fenced array element get. |
| public MethodHandle | arrayGetOpaque()
Apply the chain of transforms and bind them to an opaque (no ordering guarantee) array element get. |
| public MethodHandle | |
| public MethodHandle | |
| public MethodHandle | Returns: the full handle chain, bound to an array element set.Apply the chain of transforms and bind them to an array element set. |
| public MethodHandle | |
| public MethodHandle | arraySetOpaque()
Apply the chain of transforms and bind them to an opaque (no ordering guarantee) array element set. |
| public MethodHandle | |
| public MethodHandle | Returns: the full handle chain bound to a branchthe test handle test, MethodHandle the target handle truePath, MethodHandle the fallback handle falsePath)Apply the chain of transforms and bind them to a boolean branch as from java.lang.invoke.MethodHandles.guardWithTest. |
| public Binder | Returns: a new Binderthe target MethodType type)Cast the incoming arguments to the given MethodType. |
| public Binder | |
| public Binder | Returns: a new Binderthe target return type returnType, Class<?> the first argument type, usually a target type firstType, Class<?>... the remaining target argument types restTypes)Cast the incoming arguments to the given MethodType. |
| public Binder | Returns: a new Binderthe exception type to catch throwable, MethodHandle the function to use for handling the exception function)Catch the given exception type from the downstream chain and handle it with the given function. |
| public Binder | |
| public Binder | Returns: a new Binderthe index from which to start boxing args index, Class<?> the array type into which the args will be boxed type, MethodHandle a function to use for collecting the arguments collector)Box all incoming arguments from the given position onward into the given array type. |
| public Binder | |
| public Binder | Returns: a new Binderthe index from which to start boxing args index, int the count of arguments to box count, Class<?> the array type into which the args will be boxed type, MethodHandle a function to use for collecting the arguments collector)Box a range of incoming arguments into the given array type using the given constructor to construct the array. |
| public MethodHandle | |
| public Binder | Returns: a new Binderthe target MethodType target)Convert the incoming arguments to the given MethodType. |
| public Binder | |
| public Binder | Returns: a new Binderthe index at which to drop an argument index)Drop a single argument at the given index. |
| public Binder | Returns: a new Binderthe index at which to start dropping index, int the number of arguments to drop count)Drop from the given index a number of arguments. |
| public Binder | |
| public Binder | |
| public Binder | Returns: a new Binderthe number of arguments to drop count)Drop from the end of the argument list a number of arguments. |
| public Binder | |
| public Binder | Returns: a new Binderthe number of arguments to drop count)Drop from the end of the argument list a number of arguments. |
| public Binder | Returns: a new Binderthe index of the first argument to filter index, MethodHandle... the array of functions to transform the arguments functions)Filter incoming arguments, from the given index, replacing each with the result of calling the associated function in the given list. |
| public Binder | Returns: a new Binderthe index of the first argument to filter index, MethodHandle... the array of functions to transform the arguments functions)Filter incoming arguments, from the given index, replacing each with the result of calling the associated function in the given list. |
| public Binder | Returns: a new Binderthe array of functions to transform the arguments function)Filter return value, using a function that produces the current return type from another type. |
| public Binder | Returns: a new Binderthe function that will process the incoming arguments. Its
signature must match the current signature's arguments exactly. function)Process the incoming arguments using the given handle, inserting the result as the first argument. |
| public Binder | Returns: a new Binderthe java.lang.invoke.MethodHandles.Lookup to use lookup,the class on which the method is defined target, String the method to invoke on the first argument method)Process the incoming arguments by calling the given static method on the given class, inserting the result as the first argument. |
| public Binder | Returns: a new Binderthe class on which the method is defined target, String the method to invoke on the first argument method)Process the incoming arguments by calling the given static method on the given class, inserting the result as the first argument. |
| public Binder | Returns: a new Binderthe java.lang.invoke.MethodHandles.Lookup to use lookup,the method to invoke on the first argument method)Process the incoming arguments by calling the given method on the first argument, inserting the result as the first argument. |
| public Binder | Returns: a new Binderthe method to invoke on the first argument method)Process the incoming arguments by calling the given method on the first argument, inserting the result as the first argument. |
| public Binder | Returns: a new Binderthe function that will process the incoming arguments. Its
signature must match the current signature's arguments exactly. function)Process the incoming arguments using the given handle, leaving the argument list unmodified. |
| public static Binder | Returns: the Binder objectthe starting MethodType, for calls entering the eventual chain start)Construct a new Binder, starting from a given MethodType. |
| public static Binder | Returns: the Binder objectthe Lookup context to use for direct handles lookup,the starting MethodType, for calls entering the eventual chain start)Construct a new Binder, starting from a given MethodType. |
| public static Binder | |
| public static Binder | Returns: the Binder objectthe Lookup context to use for direct handles lookup,the return type of the incoming signature returnType)Construct a new Binder using a return type. |
| public static Binder | |
| public static Binder | Returns: the Binder objectthe Lookup context to use for direct handles lookup,the return type of the incoming signature returnType, Class<?>[] the argument types of the incoming signature argTypes)Construct a new Binder using a return type and argument types. |
| public static Binder | |
| public static Binder | Returns: the Binder objectthe Lookup context to use for direct handles lookup,the return type of the incoming signature returnType, Class<?> the first argument type of the incoming signature argType0, Class<?>... the remaining argument types of the incoming signature argTypes)Construct a new Binder using a return type and argument types. |
| public static Binder | |
| public static Binder | Returns: the Binder objectthe Lookup context to use for direct handles lookup,the starting invokebinder; the new one will start with the current endpoint type
of the given invokebinder start)Construct a new Binder, starting from a given invokebinder. |
| public MethodHandle | Returns: the full handle chain, bound to the given field accessthe MethodHandles.Lookup to use to look up the field lookup,the field's name name)Apply the chain of transforms and bind them to an object field retrieval specified using the end signature plus the given class and name. |
| public MethodHandle | getField(String name)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given field accessthe MethodHandles.Lookup to use to look up the field lookup,the field's name name)Apply the chain of transforms and bind them to an object field retrieval specified using the end signature plus the given class and name. |
| public MethodHandle | getFieldQuiet(String name)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given field accessthe MethodHandles.Lookup to use to look up the field lookup,the class in which the field is defined target, String the field's name name)Apply the chain of transforms and bind them to a static field retrieval specified using the end signature plus the given class and name. |
| public MethodHandle | getStatic(Class<?> target, String name)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given field accessthe MethodHandles.Lookup to use to look up the field lookup,the class in which the field is defined target, String the field's name name)Apply the chain of transforms and bind them to a static field retrieval specified using the end signature plus the given class and name. |
| public MethodHandle | getStaticQuiet(Class<?> target, String name)
Same as |
| public MethodHandle | Returns: a handle that has all transforms applied in sequenceApply the tranforms, binding them to a handle that will simply return its sole argument as its return value. |
| public Binder | Returns: a new Binderthe index at which to insert the argument value index, boolean the value to insert value)Insert at the given index the given boolean value. |
| public Binder | Returns: a new Binderthe index at which to insert the argument value index, byte the value to insert value)Insert at the given index the given byte value. |
| public Binder | Returns: a new Binderthe index at which to insert the argument value index, short the value to insert value)Insert at the given index the given short value. |
| public Binder | Returns: a new Binderthe index at which to insert the argument value index, char the value to insert value)Insert at the given index the given char value. |
| public Binder | Returns: a new Binderthe index at which to insert the argument value index, int the value to insert value)Insert at the given index the given int value. |
| public Binder | Returns: a new Binderthe index at which to insert the argument value index, long the value to insert value)Insert at the given index the given long value. |
| public Binder | Returns: a new Binderthe index at which to insert the argument value index, float the value to insert value)Insert at the given index the given float value. |
| public Binder | Returns: a new Binderthe index at which to insert the argument value index, double the value to insert value)Insert at the given index the given double value. |
| public Binder | |
| public Binder | |
| public Binder | |
| public MethodHandle | Returns: a handle that has all transforms applied in sequence up to endpointthe endpoint handle to bind to target)Apply the chain of transforms with the target method handle as the final endpoint. |
| public MethodHandle | Returns: the full handle chain, bound to the given methodthe MethodHandles.Lookup to use to unreflect the method lookup,the Method to unreflect method)Apply the chain of transforms and bind them to a static method specified using the end signature plus the given class and method. |
| public MethodHandle | invoke(Method method)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given constructorthe MethodHandles.Lookup to use to look up the constructor lookup,the constructor's class target)Apply the chain of transforms and bind them to a constructor specified using the end signature plus the given class. |
| public MethodHandle | invokeConstructor(Class<?> target)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given constructorthe MethodHandles.Lookup to use to look up the constructor lookup,the constructor's class target)Apply the chain of transforms and bind them to a constructor specified using the end signature plus the given class. |
| public MethodHandle | invokeConstructorQuiet(Class<?> target)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given methodthe MethodHandles.Lookup to use to unreflect the method lookup,the Method to unreflect method)Apply the chain of transforms and bind them to a static method specified using the end signature plus the given class and method. |
| public MethodHandle | invokeQuiet(Method method)
Same as |
| public MethodHandle | Returns: a new handle that invokes its leading MethodHandle argumentProduce a MethodHandle that invokes its leading MethodHandle argument with the remaining arguments, returning the result. |
| public MethodHandle | Returns: the full handle chain, bound to the given methodthe MethodHandles.Lookup to use to look up the method lookup,the name of the method to invoke name, Class<?> the calling class caller)Apply the chain of transforms and bind them to a special method specified using the end signature plus the given class and name. |
| public MethodHandle | invokeSpecial(String name, Class<?> caller)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given methodthe MethodHandles.Lookup to use to look up the method lookup,the name of the method to invoke name, Class<?> the calling class caller)Apply the chain of transforms and bind them to a special method specified using the end signature plus the given class and name. |
| public MethodHandle | invokeSpecialQuiet(String name, Class<?> caller)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given methodthe MethodHandles.Lookup to use to unreflect the method lookup,the class in which to find the method target, String the name of the method to invoke name)Apply the chain of transforms and bind them to a static method specified using the end signature plus the given class and name. |
| public MethodHandle | invokeStatic(Class<?> target, String name)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given methodthe MethodHandles.Lookup to use to look up the method lookup,the class in which to find the method target, String the name of the method to invoke name)Apply the chain of transforms and bind them to a static method specified using the end signature plus the given class and name. |
| public MethodHandle | invokeStaticQuiet(Class<?> target, String name)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given methodthe MethodHandles.Lookup to use to look up the method lookup,the name of the method to invoke name)Apply the chain of transforms and bind them to a virtual method specified using the end signature plus the given class and name. |
| public MethodHandle | invokeVirtual(String name)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given methodthe MethodHandles.Lookup to use to look up the method lookup,the name of the method to invoke name)Apply the chain of transforms and bind them to a virtual method specified using the end signature plus the given class and name. |
| public MethodHandle | invokeVirtualQuiet(String name)
Same as |
| public Binder | |
| public MethodHandle | |
| public MethodHandle | Returns: a handle that has all transforms applied and does nothing at its endpointApply all transforms to an endpoint that does absolutely nothing. |
| public Binder | Returns: a new Binderthe int offsets of the incoming arguments in the desired permutation reorder)Permute the incoming arguments to a new sequence specified by the given values. |
| public Binder | Returns: a new Binderthe value to prepend value)Prepend to the argument list the given boolean value. |
| public Binder | Returns: a new Binderthe value to prepend value)Prepend to the argument list the given byte value. |
| public Binder | Returns: a new Binderthe value to prepend value)Prepend to the argument list the given short value. |
| public Binder | Returns: a new Binderthe value to prepend value)Prepend to the argument list the given char value. |
| public Binder | Returns: a new Binderthe value to prepend value)Prepend to the argument list the given int value. |
| public Binder | Returns: a new Binderthe value to prepend value)Prepend to the argument list the given long value. |
| public Binder | Returns: a new Binderthe value to prepend value)Prepend to the argument list the given float value. |
| public Binder | Returns: a new Binderthe value to prepend value)Prepend to the argument list the given double value. |
| public Binder | |
| public Binder | |
| public Binder | |
| public Binder | Returns: a new Binderthe values to prepend values)Prepend to the argument list the given boolean values. |
| public Binder | Returns: a new Binderthe values to prepend values)Prepend to the argument list the given byte values. |
| public Binder | Returns: a new Binderthe values to prepend values)Prepend to the argument list the given char values. |
| public Binder | Returns: a new Binderthe values to prepend values)Prepend to the argument list the given double values. |
| public Binder | Returns: a new Binderthe values to prepend values)Prepend to the argument list the given float values. |
| public Binder | Returns: a new Binderthe values to prepend values)Prepend to the argument list the given int values. |
| public Binder | Returns: a new Binderthe values to prepend values)Prepend to the argument list the given long values. |
| public Binder | Returns: a new Binderthe values to prepend values)Prepend to the argument list the given short values. |
| public Binder | Returns: a new Binderthe value(s) to append typesAndValues)Prepend to the argument list the given argument type(s) and value(s), provided as (Class, value) pairs of arguments. |
| public Binder | Returns: this Bindinga PrintStream to which to println the current MethodType ps)Println the current MethodType to the given stream. |
| public Binder | |
| public MethodHandle | Returns: the full handle chain, bound to the given field assignmentthe MethodHandles.Lookup to use to look up the field lookup,the field's name name)Apply the chain of transforms and bind them to an object field assignment specified using the end signature plus the given class and name. |
| public MethodHandle | setField(String name)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given field assignmentthe MethodHandles.Lookup to use to look up the field lookup,the field's name name)Apply the chain of transforms and bind them to an object field assignment specified using the end signature plus the given class and name. |
| public MethodHandle | setFieldQuiet(String name)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given field assignmentthe MethodHandles.Lookup to use to look up the field lookup,the class in which the field is defined target, String the field's name name)Apply the chain of transforms and bind them to an object field assignment specified using the end signature plus the given class and name. |
| public MethodHandle | setStatic(Class<?> target, String name)
Same as |
| public MethodHandle | Returns: the full handle chain, bound to the given field assignmentthe MethodHandles.Lookup to use to look up the field lookup,the class in which the field is defined target, String the field's name name)Apply the chain of transforms and bind them to an object field assignment specified using the end signature plus the given class and name. |
| public MethodHandle | setStaticQuiet(Class<?> target, String name)
Same as |
| public Binder | |
| public Binder | Returns: a new Binderthe new count of arguments to spread from the trailing array count)Spread a trailing array argument into the given number of arguments of the type of the array. |
| public MethodHandle | Returns: a handle that has all transforms applied and which will eventually throw an exceptionThrow the current signature's sole Throwable argument. |
| public Binder | |
| public String | Returns: Java code for the handle adaptations this Binder would produce.Produce Java code that would perform equivalent operations to this binder. |
| public Binder | Returns: a new Binderthe logic that would live inside the "finally" block post)Apply transforms to run the given handle's logic as a "finally" block. |
| public MethodType | Returns: the current MethodTypeThe current MethodType, were the handle chain to terminate at this point. |
| public Binder | |
| public Binder | Returns: a new Binder with the given lookupthe new Lookup context to use lookupUse an alternate java.lang.invoke.MethodHandles.Lookup as the default for any direct handles created. |