Interface CollectorFactory

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean accepts​(java.lang.reflect.Type containerType)
      Accept a Type as a collector.
      java.util.stream.Collector<?,​?,​?> build​(java.lang.reflect.Type containerType)
      Creates a collector for a given container type.
      static CollectorFactory collectorFactory​(java.lang.reflect.Type containerType, java.util.stream.Collector<?,​?,​?> collector)
      Creates a CollectorFactory from a container type and a collector.
      static CollectorFactory collectorFactory​(GenericType<?> containerType, java.util.stream.Collector<?,​?,​?> collector)
      Creates a CollectorFactory from a parameterized container type and a collector.
      java.util.Optional<java.lang.reflect.Type> elementType​(java.lang.reflect.Type containerType)
      Returns the element type for a given container type.
    • Method Detail

      • accepts

        boolean accepts​(java.lang.reflect.Type containerType)
        Accept a Type as a collector.
        Parameters:
        containerType - the container type.
        Returns:
        whether this factory can produce a collector for the given container type.
      • elementType

        java.util.Optional<java.lang.reflect.Type> elementType​(java.lang.reflect.Type containerType)
        Returns the element type for a given container type.
        Parameters:
        containerType - the container type.
        Returns:
        the container element type if it can be discovered through reflection; empty otherwise.
        See Also:
        StatementContext.findElementTypeFor(Type)
      • collectorFactory

        static CollectorFactory collectorFactory​(GenericType<?> containerType,
                                                 java.util.stream.Collector<?,​?,​?> collector)
        Creates a CollectorFactory from a parameterized container type and a collector.
        Parameters:
        containerType - The parameterized container type that the factory should use
        collector - The collector to aassemble container types into a collection
        Returns:
        A collection factory instance
        Since:
        3.38.0
      • collectorFactory

        static CollectorFactory collectorFactory​(java.lang.reflect.Type containerType,
                                                 java.util.stream.Collector<?,​?,​?> collector)
        Creates a CollectorFactory from a container type and a collector.
        Parameters:
        containerType - The container type that the factory should use
        collector - The collector to aassemble container types into a collection
        Returns:
        A collection factory instance
        Since:
        3.38.0