Class JdbiCollectors

  • All Implemented Interfaces:
    JdbiConfig<JdbiCollectors>

    public class JdbiCollectors
    extends java.lang.Object
    implements JdbiConfig<JdbiCollectors>
    Registry of collector factories. Contains a set of collector factories, registered by the application.
    • Field Detail

      • factoryCache

        private java.util.concurrent.ConcurrentMap<java.lang.reflect.Type,​java.util.Optional<CollectorFactory>> factoryCache
    • Constructor Detail

      • JdbiCollectors

        public JdbiCollectors()
    • Method Detail

      • registerCollector

        public JdbiCollectors registerCollector​(java.lang.reflect.Type collectionType,
                                                java.util.stream.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:
        Configurable.registerCollector(CollectorFactory)
      • findFor

        public java.util.Optional<java.util.stream.Collector<?,​?,​?>> findFor​(java.lang.reflect.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 java.util.Optional<java.lang.reflect.Type> findElementTypeFor​(java.lang.reflect.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.
      • findFactoryFor

        private java.util.Optional<CollectorFactory> findFactoryFor​(java.lang.reflect.Type containerType)
      • 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.