Class JdbiCollectors

java.lang.Object
org.jdbi.v3.core.collector.JdbiCollectors
All Implemented Interfaces:
JdbiConfig<JdbiCollectors>

public class JdbiCollectors extends Object implements JdbiConfig<JdbiCollectors>
Registry of collector factories. Contains a set of collector factories, registered by the application.
  • Constructor Details

    • JdbiCollectors

      public JdbiCollectors()
  • Method Details

    • register

      public JdbiCollectors register(CollectorFactory factory)
      Register a new CollectorFactory.
      Parameters:
      factory - A collector factory
      Returns:
      this
    • registerCollector

      public JdbiCollectors registerCollector(Type collectionType, Collector<?,?,?> collector)
      Register a new Collector for the given type.
      Parameters:
      collectionType - The type that this collector will return
      collector - A Collector implementation
      Returns:
      this
      Since:
      3.38.0
      See Also:
    • findFor

      public Optional<Collector<?,?,?>> findFor(Type containerType)
      Obtain a collector for the given type.
      Parameters:
      containerType - the container type.
      Returns:
      a Collector for the given container type, or empty null if no collector is registered for the given type.
    • findElementTypeFor

      public Optional<Type> findElementTypeFor(Type containerType)
      Returns the element type for the given container type.
      Parameters:
      containerType - the container type.
      Returns:
      the element type for the given container type, if available.
    • createCopy

      public JdbiCollectors createCopy()
      Description copied from interface: JdbiConfig
      Returns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.
      Specified by:
      createCopy in interface JdbiConfig<JdbiCollectors>
      Returns:
      a copy of this configuration object.