Class Transform

    • Constructor Detail

      • Transform

        public Transform()
    • Method Detail

      • up

        public abstract MethodHandle up​(MethodHandle target)
        Apply this transform upward from the given MethodHandle, producing a new handle.
        Parameters:
        target - the target handle
        Returns:
        the adapted handle
      • down

        public abstract MethodType down​(MethodType source)
        Apply this transform downward from an incoming MethodType, producing a new type.
        Parameters:
        source - the source type
        Returns:
        the new type
      • toString

        public abstract String toString()
        Return a string representation of this transform.
        Overrides:
        toString in class Object
        Returns:
        a string representation of this transform
      • toJava

        public abstract String toJava​(MethodType incoming)
        Return a Java code representation of this transform.
        Returns:
        a Java code representation of this transform.
      • buildClassArguments

        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 - the builder in which to build the argument list
        types - the classes from which to create the argument list
      • buildClassArgument

        protected static void buildClassArgument​(StringBuilder builder,
                                                 Class 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 - the builder in which to build the argument
        cls - the type for the argument
      • buildClassCast

        protected static void buildClassCast​(StringBuilder builder,
                                             Class 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 - the builder in which to build the argument
        cls - the type for the argument
      • buildPrimitiveJava

        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 - the builder in which to generate the code
        value - the primitive value to generate from
      • generateMethodType

        public static String generateMethodType​(MethodType source)
        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