Package com.headius.invokebinder
Class SmartBinder
java.lang.Object
com.headius.invokebinder.SmartBinder
Maintains both a Binder, for building a series of transformations, and a
current Signature that maps symbolic names to arguments. Transformations
normally performed with Binder using argument indices can be done instead
using argument names and wildcards.
TODO: Examples, or links to wiki examples.
- Author:
- headius
-
Method Summary
Modifier and TypeMethodDescriptionAppend the given arguments to the argument list, assigning them the given names.Append the given argument to the argument list, assigning it the given name.Append the given argument to the argument list, assigning it the given name.Append the given argument to the argument list, assigning it the given name.Append the given argument to the argument list, assigning it the given name.Append the given argument to the argument list, assigning it the given name.Append the given argument to the argument list, assigning it the given name.Append the given argument to the argument list, assigning it the given name.Append the given argument to the argument list, assigning it the given name.Append the given argument to the argument list, assigning it the given name.Append the given argument to the argument list, assigning it the given name.arrayGet()
Terminate this binder by setting an array element based on the current signature.arraySet()
Terminate this binder by getting an array element based on the current signature.Get the signature this binder started with.binder()
Get the Binder instance associated with this SmartBinder.Cast the incoming arguments to the types in the given signature.Cast the incoming arguments to the return and argument types given.Cast the named argument to the given type.castReturn
(Class<?> type) Cast the return value to the given type.castVirtual
(Class<?> returnType, Class<?> firstArg, Class<?>... restArgs) Cast the incoming arguments to the return, first argument type, and remaining argument types.Collect arguments matching namePattern into an trailing array argument named outName.collect
(String outName, String namePattern, MethodHandle collector) Collect arguments matching namePattern into an trailing array argument named outName, using collector to construct the array object.Drop the argument with the given name.Drop the first argument.dropFirst
(int count) Drop the first N arguments.dropLast()
Drop the last argument.dropLast
(int count) Drop the last N arguments.Permute all parameters except the names given.filter
(String pattern, MethodHandle filter) Filter the arguments matching the given pattern using the given filter function.filterReturn
(SmartHandle filter) Use the given filter function to transform the return value at this point in the binder.filterReturn
(MethodHandle filter) Use the given filter function to transform the return value at this point in the binder.fold
(String newName, SmartHandle function) Pass all arguments to the given function and insert the resulting value as newName into the argument list.fold
(String newName, MethodHandle function) Pass all arguments to the given function and insert the resulting value as newName into the argument list.foldStatic
(String newName, Class<?> target, String method) Acquire a public static folding function from the given target class, using the given name.foldStatic
(String newName, MethodHandles.Lookup lookup, Class<?> target, String method) Acquire a static folding function from the given target class, using the given name and Lookup.foldVirtual
(String newName, MethodHandles.Lookup lookup, String method) Acquire a virtual folding function from the first argument's class, using the given name and Lookup.foldVirtual
(String newName, String method) Acquire a public virtual folding function from the first argument's class, using the given name and Lookup.foldVoid
(SmartHandle function) Pass all arguments to the given function and drop any result.foldVoid
(MethodHandle function) Pass all arguments to the given function and drop any result.static SmartBinder
Create a new SmartBinder from the given Signature.static SmartBinder
Create a new SmartBinder from the given types and argument names.static SmartBinder
Create a new SmartBinder with from the given types and argument name.static SmartBinder
from
(MethodHandles.Lookup lookup, Signature inbound) Create a new SmartBinder from the given Signature, using the given Lookup for any handle lookups.static SmartBinder
from
(MethodHandles.Lookup lookup, Class<?> retType, String[] names, Class<?>... types) Create a new SmartBinder from the given types and argument names, using the given Lookup for any handle lookups.static SmartBinder
from
(MethodHandles.Lookup lookup, Class<?> retType, String name, Class<?> type) Create a new SmartBinder from the given types and argument name, using the given Lookup for any handle lookups.identity()
Terminate this binder by returning its sole remaining argument.Insert arguments into the argument list at the given index with the given names and values.Insert an argument into the argument list at the given index with the given name and value.Insert an argument into the argument list at the given index with the given name and value.Insert an argument into the argument list at the given index with the given name and value.Insert an argument into the argument list at the given index with the given name and value.Insert an argument into the argument list at the given index with the given name and value.Insert an argument into the argument list at the given index with the given name and value.Insert an argument into the argument list at the given index with the given name and value.Insert an argument into the argument list at the given index with the given name and value.Insert an argument into the argument list at the given index with the given name and value.Insert an argument into the argument list at the given index with the given name and value.invoke
(SmartHandle target) Terminate this binder by invoking the given target handle.invoke
(MethodHandle target) Terminate this binder by invoking the given target handle.invoker()
Produce a SmartHandle from this binder that invokes a leading MethodHandle argument with the remaining arguments.invokeStatic
(MethodHandles.Lookup lookup, Class<?> target, String name) Terminate this binder by looking up the named static method on the given target type.invokeStaticQuiet
(MethodHandles.Lookup lookup, Class<?> target, String name) Terminate this binder by looking up the named static method on the given target type.invokeVirtual
(MethodHandles.Lookup lookup, String name) Terminate this binder by looking up the named virtual method on the first argument's type.invokeVirtualQuiet
(MethodHandles.Lookup lookup, String name) Terminate this binder by looking up the named virtual method on the first argument's type.Using the argument names and order in the target Signature, permute the arguments in this SmartBinder.Using the argument names and order in the given targetNames, permute the arguments in this SmartBinder.Prepend the given arguments to the argument list, assigning them the given name.Prepend the given argument to the argument list, assigning it the given name.Prepend the given argument to the argument list, assigning it the given name.Prepend the given argument to the argument list, assigning it the given name.Prepend the given argument to the argument list, assigning it the given name.Prepend the given argument to the argument list, assigning it the given name.Prepend the given argument to the argument list, assigning it the given name.Prepend the given argument to the argument list, assigning it the given name.Prepend the given argument to the argument list, assigning it the given name.Prepend the given argument to the argument list, assigning it the given name.Prepend the given argument to the argument list, assigning it the given name.Print this binder's current signature to System.out.Print this binder's current signature to the give PrintStream.Get the current Signature for this binder.Spread a trailing array into the specified argument types.Spread a trailing array into count number of arguments, using the natural component type for the array.tryFinally
(MethodHandle post)
-
Method Details
-
signature
Get the current Signature for this binder.- Returns:
- this binder's current Signature
-
baseSignature
Get the signature this binder started with.- Returns:
- the signature this binder started with.
-
binder
Get the Binder instance associated with this SmartBinder.- Returns:
- this SmartBinder's Binder instance
-
from
Create a new SmartBinder from the given Signature.- Parameters:
inbound
- the Signature to start from- Returns:
- a new SmartBinder
-
from
Create a new SmartBinder from the given types and argument names.- Parameters:
retType
- the type of the return value to start withnames
- the names of argumentstypes
- the argument types- Returns:
- a new SmartBinder
-
from
Create a new SmartBinder with from the given types and argument name.- Parameters:
retType
- the type of the return value to start withname
- the name of the sole argumenttype
- the sole argument's type- Returns:
- a new SmartBinder
-
from
Create a new SmartBinder from the given Signature, using the given Lookup for any handle lookups.- Parameters:
lookup
- the Lookup to use for handle lookupsinbound
- the Signature to start from- Returns:
- a new SmartBinder
-
from
public static SmartBinder from(MethodHandles.Lookup lookup, Class<?> retType, String[] names, Class<?>... types) Create a new SmartBinder from the given types and argument names, using the given Lookup for any handle lookups.- Parameters:
lookup
- the Lookup to use for handle lookupsretType
- the type of the return value to start withnames
- the names of argumentstypes
- the argument types- Returns:
- a new SmartBinder
-
from
public static SmartBinder from(MethodHandles.Lookup lookup, Class<?> retType, String name, Class<?> type) Create a new SmartBinder from the given types and argument name, using the given Lookup for any handle lookups.- Parameters:
lookup
- the Lookup to use for handle lookupsretType
- the type of the return value to start withname
- the name of the sole argumentstype
- the sole argument's type- Returns:
- a new SmartBinder
-
fold
Pass all arguments to the given function and insert the resulting value as newName into the argument list.- Parameters:
newName
- the name of the new first argument where the fold function's result will be passedfunction
- a function which will receive all arguments and have its return value inserted into the call chain- Returns:
- a new SmartBinder with the fold applied
-
fold
Pass all arguments to the given function and insert the resulting value as newName into the argument list.- Parameters:
newName
- the name of the new first argument where the fold function's result will be passedfunction
- a function which will receive all arguments and have its return value inserted into the call chain- Returns:
- a new SmartBinder with the fold applied
-
foldVoid
Pass all arguments to the given function and drop any result.- Parameters:
function
- a function which will receive all arguments and have its return value inserted into the call chain- Returns:
- a new SmartBinder with the fold applied
-
foldVoid
Pass all arguments to the given function and drop any result.- Parameters:
function
- a function which will receive all arguments and have its return value inserted into the call chain- Returns:
- a new SmartBinder with the fold applied
-
foldStatic
public SmartBinder foldStatic(String newName, MethodHandles.Lookup lookup, Class<?> target, String method) Acquire a static folding function from the given target class, using the given name and Lookup. Pass all arguments to that function and insert the resulting value as newName into the argument list.- Parameters:
newName
- the name of the new first argument where the fold function's result will be passedlookup
- the Lookup to use for acquiring a folding functiontarget
- the class on which to find the folding functionmethod
- the name of the method to become a folding function- Returns:
- a new SmartBinder with the fold applied
-
foldStatic
Acquire a public static folding function from the given target class, using the given name. Pass all arguments to that function and insert the resulting value as newName into the argument list.- Parameters:
newName
- the name of the new first argument where the fold function's result will be passedtarget
- the class on which to find the folding functionmethod
- the name of the method to become a folding function- Returns:
- a new SmartBinder with the fold applied
-
foldVirtual
Acquire a virtual folding function from the first argument's class, using the given name and Lookup. Pass all arguments to that function and insert the resulting value as newName into the argument list.- Parameters:
newName
- the name of the new first argument where the fold function's result will be passedlookup
- the Lookup to use for acquiring a folding functionmethod
- the name of the method to become a folding function- Returns:
- a new SmartBinder with the fold applied
-
foldVirtual
Acquire a public virtual folding function from the first argument's class, using the given name and Lookup. Pass all arguments to that function and insert the resulting value as newName into the argument list.- Parameters:
newName
- the name of the new first argument where the fold function's result will be passedmethod
- the name of the method to become a folding function- Returns:
- a new SmartBinder with the fold applied
-
permute
Using the argument names and order in the target Signature, permute the arguments in this SmartBinder. Arguments may be duplicated or omitted in the target Signature, but all arguments in the target must be defined in this SmartBinder .- Parameters:
target
- the Signature from which to derive a new argument list- Returns:
- a new SmartBinder with the permute applied
-
permute
Using the argument names and order in the given targetNames, permute the arguments in this SmartBinder. Arguments may be duplicated or omitted in the targetNames array, but all arguments in the target must be defined in this SmartBinder.- Parameters:
targetNames
- the array of names from which to derive a new argument list- Returns:
- a new SmartBinder with the permute applied
-
exclude
Permute all parameters except the names given. Blacklisting to #permute's whitelisting.- Parameters:
excludeNames
- parameter patterns to exclude- Returns:
- a new SmartBinder with the exclude applied
-
spread
Spread a trailing array into the specified argument types.- Parameters:
spreadNames
- the names for the spread out argumentsspreadTypes
- the types as which to spread the incoming array- Returns:
- a new SmartBinder with the spread applied
-
spread
Spread a trailing array into count number of arguments, using the natural component type for the array. Build names for the arguments using the given baseName plus the argument's index. Example: Current binder has a signature of (int, String[])void. We want to spread the strings into five arguments named "str".binder = binder.spread("str", 5)
The resulting signature will have five trailing arguments named "arg0" through "arg4".- Parameters:
baseName
- the base name from which to create the new argument namescount
- the count of arguments to spread- Returns:
- a new SmartBinder with the spread applied
-
insert
Insert an argument into the argument list at the given index with the given name and value.- Parameters:
index
- the index at which to insert the argumentname
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the insert applied
-
insert
Insert an argument into the argument list at the given index with the given name and value.- Parameters:
index
- the index at which to insert the argumentname
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the insert applied
-
insert
Insert an argument into the argument list at the given index with the given name and value.- Parameters:
index
- the index at which to insert the argumentname
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the insert applied
-
insert
Insert an argument into the argument list at the given index with the given name and value.- Parameters:
index
- the index at which to insert the argumentname
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the insert applied
-
insert
Insert an argument into the argument list at the given index with the given name and value.- Parameters:
index
- the index at which to insert the argumentname
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the insert applied
-
insert
Insert an argument into the argument list at the given index with the given name and value.- Parameters:
index
- the index at which to insert the argumentname
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the insert applied
-
insert
Insert an argument into the argument list at the given index with the given name and value.- Parameters:
index
- the index at which to insert the argumentname
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the insert applied
-
insert
Insert an argument into the argument list at the given index with the given name and value.- Parameters:
index
- the index at which to insert the argumentname
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the insert applied
-
insert
Insert an argument into the argument list at the given index with the given name and value.- Parameters:
index
- the index at which to insert the argumentname
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the insert applied
-
insert
Insert an argument into the argument list at the given index with the given name and value.- Parameters:
index
- the index at which to insert the argumentname
- the name of the new argumenttype
- the type to use in the new signaturevalue
- the value of the new argument- Returns:
- a new SmartBinder with the insert applied
-
insert
Insert arguments into the argument list at the given index with the given names and values.- Parameters:
index
- the index at which to insert the argumentsnames
- the names of the new argumentstypes
- the types of the new argumentsvalues
- the values of the new arguments- Returns:
- a new SmartBinder with the insert applied
-
append
Append the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the append applied
-
append
Append the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the append applied
-
append
Append the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the append applied
-
append
Append the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the append applied
-
append
Append the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the append applied
-
append
Append the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the append applied
-
append
Append the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the append applied
-
append
Append the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the append applied
-
append
Append the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the append applied
-
append
Append the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumenttype
- the type to use in the new signaturevalue
- the value of the new argument- Returns:
- a new SmartBinder with the append applied
-
append
Append the given arguments to the argument list, assigning them the given names.- Parameters:
names
- the names of the new argumentstypes
- the types to use in the new signaturevalues
- the values of the new arguments- Returns:
- a new SmartBinder with the append applied
-
prepend
Prepend the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the prepend applied
-
prepend
Prepend the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the prepend applied
-
prepend
Prepend the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the prepend applied
-
prepend
Prepend the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the prepend applied
-
prepend
Prepend the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the prepend applied
-
prepend
Prepend the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the prepend applied
-
prepend
Prepend the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the prepend applied
-
prepend
Prepend the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the prepend applied
-
prepend
Prepend the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumentvalue
- the value of the new argument- Returns:
- a new SmartBinder with the prepend applied
-
prepend
Prepend the given argument to the argument list, assigning it the given name.- Parameters:
name
- the name of the new argumenttype
- the type to use in the new signaturevalue
- the value of the new argument- Returns:
- a new SmartBinder with the prepend applied
-
prepend
Prepend the given arguments to the argument list, assigning them the given name.- Parameters:
names
- the names of the new argumentstypes
- the types to use in the new signaturevalues
- the values of the new arguments- Returns:
- a new SmartBinder with the prepend applied
-
drop
Drop the argument with the given name.- Parameters:
name
- the name of the argument to drop- Returns:
- a new SmartBinder with the drop applied
-
dropLast
Drop the last argument.- Returns:
- a new SmartBinder with the drop applied
-
dropLast
Drop the last N arguments.- Parameters:
count
- the count of arguments to drop- Returns:
- a new SmartBinder with the drop applied
-
dropFirst
Drop the first argument.- Returns:
- a new SmartBinder with the drop applied
-
dropFirst
Drop the first N arguments.- Parameters:
count
- the count of arguments to drop- Returns:
- a new SmartBinder with the drop applied
-
collect
Collect arguments matching namePattern into an trailing array argument named outName. The namePattern is a standard regular expression.- Parameters:
outName
- the name of the new array argumentnamePattern
- a pattern with which to match arguments for collecting- Returns:
- a new SmartBinder with the collect applied
-
collect
Collect arguments matching namePattern into an trailing array argument named outName, using collector to construct the array object. The collector signature should match (T1, ..., Tn) where T is the type of the arguments being collected and n is the number of arguments being collected. The namePattern is a standard regular expression.- Parameters:
outName
- the name of the new array argumentnamePattern
- a pattern with which to match arguments for collectingcollector
- a function to use for collecting the arguments- Returns:
- a new SmartBinder with the collect applied
-
cast
Cast the incoming arguments to the types in the given signature. The argument count must match, but the names in the target signature are ignored.- Parameters:
target
- the Signature to which arguments should be cast- Returns:
- a new SmartBinder with the cast applied
-
cast
Cast the incoming arguments to the return and argument types given. The argument count must match.- Parameters:
returnType
- the return type for the casted signatureargTypes
- the types of the arguments for the casted signature- Returns:
- a new SmartBinder with the cast applied
-
castVirtual
Cast the incoming arguments to the return, first argument type, and remaining argument types. Provide for convenience when dealing with virtual method argument lists, which frequently omit the target object.- Parameters:
returnType
- the return type for the casted signaturefirstArg
- the type of the first argument for the casted signaturerestArgs
- the types of the remaining arguments for the casted signature- Returns:
- a new SmartBinder with the cast applied.
-
castArg
Cast the named argument to the given type.- Parameters:
name
- the name of the argument to casttype
- the type to which that argument will be cast- Returns:
- a new SmartBinder with the cast applied
-
castReturn
Cast the return value to the given type. Example: Our current signature is (String)String but the method this handle will eventually call returns CharSequence.binder = binder.castReturn(CharSequence.class);
Our handle will now successfully find and call the target method and propagate the returned CharSequence as a String.- Parameters:
type
- the new type for the return value- Returns:
- a new SmartBinder
-
filterReturn
Use the given filter function to transform the return value at this point in the binder. The filter will be inserted into the handle, and return values will pass through it before continuing. The filter's argument must match the expected return value downstream from this point in the binder, and the return value must match the return value at this point in the binder.- Parameters:
filter
- the function to use to transform the return value at this point- Returns:
- a new SmartBinder with the filter applied
-
filterReturn
Use the given filter function to transform the return value at this point in the binder. The filter will be inserted into the handle, and return values will pass through it before continuing. The filter's argument must match the expected return value downstream from this point in the binder, and the return value must match the return value at this point in the binder.- Parameters:
filter
- the function to use to transform the return value at this point- Returns:
- a new SmartBinder with the filter applied
-
invokeVirtual
public SmartHandle invokeVirtual(MethodHandles.Lookup lookup, String name) throws NoSuchMethodException, IllegalAccessException Terminate this binder by looking up the named virtual method on the first argument's type. Perform the actual method lookup using the given Lookup object.- Parameters:
lookup
- the Lookup to use for handle lookupsname
- the name of the target virtual method- Returns:
- a SmartHandle with this binder's starting signature, bound to the target method
- Throws:
NoSuchMethodException
- if the named method with current signature's types does not existIllegalAccessException
- if the named method is not accessible to the given Lookup
-
invokeVirtualQuiet
Terminate this binder by looking up the named virtual method on the first argument's type. Perform the actual method lookup using the given Lookup object. If the lookup fails, a RuntimeException will be raised, containing the actual reason. This method is for convenience in (for example) field declarations, where checked exceptions noise up code that can't recover anyway. Use this in situations where you would not expect your library to be usable if the target method can't be acquired.- Parameters:
lookup
- the Lookup to use for handle lookupsname
- the name of the target virtual method- Returns:
- a SmartHandle with this binder's starting signature, bound to the target method
-
invokeStatic
public SmartHandle invokeStatic(MethodHandles.Lookup lookup, Class<?> target, String name) throws NoSuchMethodException, IllegalAccessException Terminate this binder by looking up the named static method on the given target type. Perform the actual method lookup using the given Lookup object.- Parameters:
lookup
- the Lookup to use for handle lookupstarget
- the type on which to find the static methodname
- the name of the target static method- Returns:
- a SmartHandle with this binder's starting signature, bound to the target method
- Throws:
NoSuchMethodException
- if the named method with current signature's types does not existIllegalAccessException
- if the named method is not accessible to the given Lookup
-
invokeStaticQuiet
Terminate this binder by looking up the named static method on the given target type. Perform the actual method lookup using the given Lookup object. If the lookup fails, a RuntimeException will be raised, containing the actual reason. This method is for convenience in (for example) field declarations, where checked exceptions noise up code that can't recover anyway. Use this in situations where you would not expect your library to be usable if the target method can't be acquired.- Parameters:
lookup
- the Lookup to use for handle lookupstarget
- the type on which to find the static methodname
- the name of the target static method- Returns:
- a SmartHandle with this binder's starting signature, bound to the target method
-
invoke
Terminate this binder by invoking the given target handle. The signature of this binder is not compared to the signature of the given SmartHandle.- Parameters:
target
- the handle to invoke- Returns:
- a new SmartHandle with this binder's starting signature, bound through to the given handle
-
invoke
Terminate this binder by invoking the given target handle.- Parameters:
target
- the handle to invoke- Returns:
- a new SmartHandle with this binder's starting signature, bound through to the given handle
-
arrayGet
Terminate this binder by setting an array element based on the current signature. The signature should have the array as its first argument, an integer index as its second, and an appropriately-typed value as its third. It should have a void return value. Invoking the resulting handle will (eventually) perform the array assignment.- Returns:
- a new SmartHandle with this binder's starting signature, bound to an array assignment operation
-
arraySet
Terminate this binder by getting an array element based on the current signature. The signature should have the array as its first argument and an integer index as its second, and an appropriately-typed return value. Invoking the resulting handle will (eventually) perform the array assignment.- Returns:
- a new SmartHandle with this binder's starting signature, bound to an array dereference operation
-
identity
Terminate this binder by returning its sole remaining argument. The signature must take only one argument whose type matches the return type. Invoking the resulting handle will (eventually) return the argument passed in at this point.- Returns:
- a new SmartHandle with this binder's starting signature that simply returns its sole received argument
-
printSignature
Print this binder's current signature to System.out.- Returns:
- this SmartBinder
-
printSignature
Print this binder's current signature to the give PrintStream.- Returns:
- this SmartBinder
-
invoker
Produce a SmartHandle from this binder that invokes a leading MethodHandle argument with the remaining arguments.- Returns:
- a SmartHandle that invokes its leading MethodHandle argument
-
filter
Filter the arguments matching the given pattern using the given filter function.- Parameters:
pattern
- the regular expression pattern to match argumentsfilter
- the MethodHandle to use to filter the arguments- Returns:
- a new SmartBinder with the filter applied
-
tryFinally
- See Also:
-