Class Collect


  • public class Collect
    extends Transform
    An argument-boxing transform with a fixed incoming size. Equivalent call: MethodHandle.asCollector(Class, int) or MethodHandles.collectArguments
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  Collect.Permutes  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Class<?> arrayType  
      private java.lang.invoke.MethodHandle collector  
      private int count  
      private int index  
      private java.lang.invoke.MethodType source  
    • Constructor Summary

      Constructors 
      Constructor Description
      Collect​(java.lang.invoke.MethodType source, int index, int count, java.lang.Class<?> arrayType)  
      Collect​(java.lang.invoke.MethodType source, int index, int count, java.lang.Class<?> arrayType, java.lang.invoke.MethodHandle collector)  
      Collect​(java.lang.invoke.MethodType source, int index, java.lang.Class<?> arrayType)  
      Collect​(java.lang.invoke.MethodType source, int index, java.lang.Class<?> arrayType, java.lang.invoke.MethodHandle collector)  
    • Field Detail

      • source

        private final java.lang.invoke.MethodType source
      • index

        private final int index
      • count

        private final int count
      • arrayType

        private final java.lang.Class<?> arrayType
      • collector

        private final java.lang.invoke.MethodHandle collector
    • Constructor Detail

      • Collect

        public Collect​(java.lang.invoke.MethodType source,
                       int index,
                       java.lang.Class<?> arrayType)
      • Collect

        public Collect​(java.lang.invoke.MethodType source,
                       int index,
                       java.lang.Class<?> arrayType,
                       java.lang.invoke.MethodHandle collector)
      • Collect

        public Collect​(java.lang.invoke.MethodType source,
                       int index,
                       int count,
                       java.lang.Class<?> arrayType)
      • Collect

        public Collect​(java.lang.invoke.MethodType source,
                       int index,
                       int count,
                       java.lang.Class<?> arrayType,
                       java.lang.invoke.MethodHandle collector)
    • Method Detail

      • up

        public java.lang.invoke.MethodHandle up​(java.lang.invoke.MethodHandle target)
        Description copied from class: Transform
        Apply this transform upward from the given MethodHandle, producing a new handle.
        Specified by:
        up in class Transform
        Parameters:
        target - the target handle
        Returns:
        the adapted handle
      • down

        public java.lang.invoke.MethodType down​(java.lang.invoke.MethodType type)
        Description copied from class: Transform
        Apply this transform downward from an incoming MethodType, producing a new type.
        Specified by:
        down in class Transform
        Parameters:
        type - the source type
        Returns:
        the new type
      • assertTypesAreCompatible

        private void assertTypesAreCompatible()
      • toString

        public java.lang.String toString()
        Description copied from class: Transform
        Return a string representation of this transform.
        Specified by:
        toString in class Transform
        Returns:
        a string representation of this transform
      • toJava

        public java.lang.String toJava​(java.lang.invoke.MethodType incoming)
        Description copied from class: Transform
        Return a Java code representation of this transform.
        Specified by:
        toJava in class Transform
        Returns:
        a Java code representation of this transform.
      • onlyTail

        private boolean onlyTail()
      • buildPermutes

        private Collect.Permutes buildPermutes​(java.lang.invoke.MethodType source,
                                               java.lang.invoke.MethodType target)