Class Transform

    • Constructor Summary

      Constructors 
      Constructor Description
      Transform()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected static void buildClassArgument​(java.lang.StringBuilder builder, java.lang.Class cls)
      Build Java code to represent a single .class reference.
      protected static void buildClassArguments​(java.lang.StringBuilder builder, java.lang.Class<?>[] types)
      Build a list of argument type classes suitable for inserting into Java code.
      protected static void buildClassCast​(java.lang.StringBuilder builder, java.lang.Class cls)
      Build Java code to represent a cast to the given type.
      protected static void buildPrimitiveJava​(java.lang.StringBuilder builder, java.lang.Object value)
      Build Java code to represent a literal primitive.
      abstract java.lang.invoke.MethodType down​(java.lang.invoke.MethodType source)
      Apply this transform downward from an incoming MethodType, producing a new type.
      static java.lang.String generateMethodType​(java.lang.invoke.MethodType source)
      Build Java code appropriate for standing up the given MethodType.
      abstract java.lang.String toJava​(java.lang.invoke.MethodType incoming)
      Return a Java code representation of this transform.
      abstract java.lang.String toString()
      Return a string representation of this transform.
      abstract java.lang.invoke.MethodHandle up​(java.lang.invoke.MethodHandle target)
      Apply this transform upward from the given MethodHandle, producing a new handle.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Transform

        public Transform()
    • Method Detail

      • up

        public abstract java.lang.invoke.MethodHandle up​(java.lang.invoke.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 java.lang.invoke.MethodType down​(java.lang.invoke.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 java.lang.String toString()
        Return a string representation of this transform.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this transform
      • toJava

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

        protected static void buildClassArguments​(java.lang.StringBuilder builder,
                                                  java.lang.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​(java.lang.StringBuilder builder,
                                                 java.lang.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​(java.lang.StringBuilder builder,
                                             java.lang.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​(java.lang.StringBuilder builder,
                                                 java.lang.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 java.lang.String generateMethodType​(java.lang.invoke.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