Interface CollectorFactory


public interface CollectorFactory
Factory for building Collectors to assemble containers of elements. The collector produces only objects of the type of the container elements.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accepts(Type containerType)
    Accept a Type as a collector.
    Collector<?,?,?>
    build(Type containerType)
    Creates a collector for a given container type.
    elementType(Type containerType)
    Returns the element type for a given container type.
  • Method Details

    • accepts

      boolean accepts(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

      Optional<Type> elementType(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:
    • build

      Collector<?,?,?> build(Type containerType)
      Creates a collector for a given container type.
      Parameters:
      containerType - the container type.
      Returns:
      a Collector for the given container type.
      See Also: