java.lang.Object
com.headius.invokebinder.transform.Transform
- Direct Known Subclasses:
Cast,Catch,Collect,Convert,Drop,Filter,FilterReturn,Fold,Insert,Permute,Spread,TryFinally,Varargs
Abstract reprensentation of some handle transform.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidbuildClass(StringBuilder builder, Class cls) Build Java code to represent a type reference to the given class.protected static voidbuildClassArgument(StringBuilder builder, Class cls) Build Java code to represent a single .class reference.protected static voidbuildClassArguments(StringBuilder builder, Class<?>[] types) Build a list of argument type classes suitable for inserting into Java code.protected static voidbuildClassCast(StringBuilder builder, Class cls) Build Java code to represent a cast to the given type.protected static voidbuildPrimitiveJava(StringBuilder builder, Object value) Build Java code to represent a literal primitive.abstract MethodTypedown(MethodType source) Apply this transform downward from an incoming MethodType, producing a new type.static StringgenerateMethodType(MethodType source) Build Java code appropriate for standing up the given MethodType.abstract StringtoJava(MethodType incoming) Return a Java code representation of this transform.abstract StringtoString()Return a string representation of this transform.abstract MethodHandleup(MethodHandle target) Apply this transform upward from the given MethodHandle, producing a new handle.
-
Constructor Details
-
Transform
public Transform()
-
-
Method Details
-
up
Apply this transform upward from the given MethodHandle, producing a new handle.- Parameters:
target- the target handle- Returns:
- the adapted handle
-
down
Apply this transform downward from an incoming MethodType, producing a new type.- Parameters:
source- the source type- Returns:
- the new type
-
toString
Return a string representation of this transform. -
toJava
Return a Java code representation of this transform.- Returns:
- a Java code representation of this transform.
-
buildClassArguments
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- the builder in which to build the argument listtypes- the classes from which to create the argument list
-
buildClassArgument
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- the builder in which to build the argumentcls- the type for the argument
-
buildClassCast
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- the builder in which to build the argumentcls- the type for the argument
-
buildPrimitiveJava
Build Java code to represent a literal primitive. This will append L or F as appropriate for long and float primitives.- Parameters:
builder- the builder in which to generate the codevalue- the primitive value to generate from
-
buildClass
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- the builder in which to build the type referencecls- the type for the reference
-
generateMethodType
Build Java code appropriate for standing up the given MethodType.- Parameters:
source- the MethodType for which to build Java code- Returns:
- Java code suitable for building the given MethodType
-