Top Description Inners Fields Constructors Methods
com.headius.invokebinder.transform

public Class Collect

extends Transform
Class Inheritance
Imports
com.headius.invokebinder.Binder, .Util, java.lang.invoke.MethodHandle, .MethodHandles, .MethodType

A filter that takes multiple arguments and replaces them with zero or one argument of a new type. Equivalent call: MethodHandle.asCollector(Class, int) or MethodHandles.collectArguments

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final MethodHandle
private final int
private final int
private final Class<?>
private final MethodType

Constructor Summary

AccessConstructor and Description
public
Collect(MethodType source, int index, Class<?> resultType)

public
Collect(MethodType source, int index, Class<?> resultType, MethodHandle collector)

public
Collect(MethodType source, int index, int count, Class<?> resultType)

public
Collect(MethodType source, int index, int count, Class<?> resultType, MethodHandle collector)

Method Summary

Modifier and TypeMethod and Description
private void
private Collect.Permutes
public MethodType
down(MethodType
the source type
type
)

Implements abstract com.headius.invokebinder.transform.Transform.down.

Apply this transform downward from an incoming MethodType, producing a new type.
private boolean
private Binder
public String
toJava(MethodType incoming)

Implements abstract com.headius.invokebinder.transform.Transform.toJava.

Return a Java code representation of this transform.
public String
toString()

Implements abstract com.headius.invokebinder.transform.Transform.toString.

Return a string representation of this transform.
public MethodHandle
up(MethodHandle
the target handle
target
)

Implements abstract com.headius.invokebinder.transform.Transform.up.

Apply this transform upward from the given MethodHandle, producing a new handle.
Inherited from com.headius.invokebinder.transform.Transform:
buildClassArgumentbuildClassArgumentsbuildClassCastbuildPrimitiveJavagenerateMethodType

Field Detail

collectorback to summary
private final MethodHandle collector
countback to summary
private final int count
indexback to summary
private final int index
resultTypeback to summary
private final Class<?> resultType
sourceback to summary
private final MethodType source

Constructor Detail

Collectback to summary
public Collect(MethodType source, int index, Class<?> resultType)
Collectback to summary
public Collect(MethodType source, int index, Class<?> resultType, MethodHandle collector)
Collectback to summary
public Collect(MethodType source, int index, int count, Class<?> resultType)
Collectback to summary
public Collect(MethodType source, int index, int count, Class<?> resultType, MethodHandle collector)

Method Detail

assertTypesAreCompatibleback to summary
private void assertTypesAreCompatible()
buildPermutesback to summary
private Collect.Permutes buildPermutes(MethodType source, MethodType target)
downback to summary
public MethodType down(MethodType type)

Implements abstract com.headius.invokebinder.transform.Transform.down.

Doc from com.headius.invokebinder.transform.Transform.down.

Apply this transform downward from an incoming MethodType, producing a new type.

Parameters
type:MethodType

the source type

Returns:MethodType

the new type

onlyTailback to summary
private boolean onlyTail()
preparePermuteBinderback to summary
private Binder preparePermuteBinder(Collect.Permutes permutes)
toJavaback to summary
public String toJava(MethodType incoming)

Implements abstract com.headius.invokebinder.transform.Transform.toJava.

Doc from com.headius.invokebinder.transform.Transform.toJava.

Return a Java code representation of this transform.

Returns:String

a Java code representation of this transform.

toStringback to summary
public String toString()

Implements abstract com.headius.invokebinder.transform.Transform.toString.

Doc from com.headius.invokebinder.transform.Transform.toString.

Return a string representation of this transform.

Returns:String

a string representation of this transform

upback to summary
public MethodHandle up(MethodHandle target)

Implements abstract com.headius.invokebinder.transform.Transform.up.

Doc from com.headius.invokebinder.transform.Transform.up.

Apply this transform upward from the given MethodHandle, producing a new handle.

Parameters
target:MethodHandle

the target handle

Returns:MethodHandle

the adapted handle

com.headius.invokebinder.transform back to summary

private Class Collect.Permutes

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final int[]
private final int[]

Constructor Summary

AccessConstructor and Description
private
Permutes(MethodType source, MethodType target, int index, int count)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

moveBackPermuteback to summary
private final int[] moveBackPermute
movePermuteback to summary
private final int[] movePermute

Constructor Detail

Permutesback to summary
private Permutes(MethodType source, MethodType target, int index, int count)