Top Description Constructors Methods
com.headius.invokebinder.transform

public abstract Class Transform

extends Object
Class Inheritance
Known Direct Subclasses
com.headius.invokebinder.transform.TryFinally, com.headius.invokebinder.transform.Varargs, com.headius.invokebinder.transform.Cast, com.headius.invokebinder.transform.Catch, com.headius.invokebinder.transform.Collect, com.headius.invokebinder.transform.Convert, com.headius.invokebinder.transform.Drop, com.headius.invokebinder.transform.Filter, com.headius.invokebinder.transform.FilterReturn, com.headius.invokebinder.transform.Fold, com.headius.invokebinder.transform.Insert, com.headius.invokebinder.transform.Permute, com.headius.invokebinder.transform.Spread
Imports
java.lang.invoke.MethodHandle, .MethodType

Abstract reprensentation of some handle transform.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
buildClass(StringBuilder
the builder in which to build the type reference
builder
,
Class<T>
the type for the reference
cls
)

Build Java code to represent a type reference to the given class.

protected static void
buildClassArgument(StringBuilder
the builder in which to build the argument
builder
,
Class<T>
the type for the argument
cls
)

Build Java code to represent a single .class reference.

protected static void
buildClassArguments(StringBuilder
the builder in which to build the argument list
builder
,
Class<?>[]
the classes from which to create the argument list
types
)

Build a list of argument type classes suitable for inserting into Java code.

protected static void
buildClassCast(StringBuilder
the builder in which to build the argument
builder
,
Class<T>
the type for the argument
cls
)

Build Java code to represent a cast to the given type.

protected static void
buildPrimitiveJava(StringBuilder
the builder in which to generate the code
builder
,
Object
the primitive value to generate from
value
)

Build Java code to represent a literal primitive.

public abstract MethodType

Returns:

the new type
down
(MethodType
the source type
source
)

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

public static String

Returns:

Java code suitable for building the given MethodType
generateMethodType
(MethodType
the MethodType for which to build Java code
source
)

Build Java code appropriate for standing up the given MethodType.

public abstract String

Returns:

a Java code representation of this transform.
toJava
(MethodType incoming)

Return a Java code representation of this transform.

public abstract String

Returns:

a string representation of this transform
toString
()

Overrides java.lang.Object.toString.

Return a string representation of this transform.
public abstract MethodHandle

Returns:

the adapted handle
up
(MethodHandle
the target handle
target
)

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Constructor Detail

Transformback to summary
public Transform()

Method Detail

buildClassback to summary
private static void buildClass(StringBuilder builder, Class<T> cls)

Build Java code to represent a type reference to the given class. This will be of the form "pkg.Cls1" or "pkc.Cls2[]" or "primtype".

Parameters
builder:StringBuilder

the builder in which to build the type reference

cls:Class<T>

the type for the reference

buildClassArgumentback to summary
protected static void buildClassArgument(StringBuilder builder, Class<T> cls)

Build Java code to represent a single .class reference. This will be an argument of the form "pkg.Cls1.class" or "pkg.Cls2[].class" or "primtype.class"

Parameters
builder:StringBuilder

the builder in which to build the argument

cls:Class<T>

the type for the argument

buildClassArgumentsback to summary
protected static void buildClassArguments(StringBuilder builder, Class<?>[] types)

Build a list of argument type classes suitable for inserting into Java code. This will be an argument list of the form "pkg.Cls1.class, pkg.Cls2[].class, primtype.class, ..."

Parameters
builder:StringBuilder

the builder in which to build the argument list

types:Class<?>[]

the classes from which to create the argument list

buildClassCastback to summary
protected static void buildClassCast(StringBuilder builder, Class<T> cls)

Build Java code to represent a cast to the given type. This will be an argument of the form "(pkg.Cls1)" or "(pkg.Cls2[])" or "(primtype)"

Parameters
builder:StringBuilder

the builder in which to build the argument

cls:Class<T>

the type for the argument

buildPrimitiveJavaback to summary
protected static void buildPrimitiveJava(StringBuilder builder, Object value)

Build Java code to represent a literal primitive. This will append L or F as appropriate for long and float primitives.

Parameters
builder:StringBuilder

the builder in which to generate the code

value:Object

the primitive value to generate from

downback to summary
public abstract MethodType down(MethodType source)

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

Parameters
source:MethodType

the source type

Returns:MethodType

the new type

generateMethodTypeback to summary
public static String generateMethodType(MethodType source)

Build Java code appropriate for standing up the given MethodType.

Parameters
source:MethodType

the MethodType for which to build Java code

Returns:String

Java code suitable for building the given MethodType

toJavaback to summary
public abstract String toJava(MethodType incoming)

Return a Java code representation of this transform.

Returns:String

a Java code representation of this transform.

toStringback to summary
public abstract String toString()

Overrides java.lang.Object.toString.

Return a string representation of this transform.

Returns:String

a string representation of this transform

upback to summary
public abstract MethodHandle up(MethodHandle target)

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

Parameters
target:MethodHandle

the target handle

Returns:MethodHandle

the adapted handle