Class BuiltInCollectorFactory

  • All Implemented Interfaces:
    CollectorFactory

    @Deprecated
    public class BuiltInCollectorFactory
    extends java.lang.Object
    implements CollectorFactory
    Deprecated.
    will be replaced by plugin
    Provides Collectors for built in JDK container types.

    Supported container types:

    • java.util.Optional<T> (throws an exception if more than one row in result)
    • java.util.Collection<T>
    • java.util.List<T>
    • java.util.ArrayList<T>
    • java.util.LinkedList<T>
    • java.util.concurrent.CopyOnWriteArrayList<T>
    • java.util.Set<T>
    • java.util.HashSet<T>
    • java.util.LinkedHashSet<T>
    • java.util.SortedSet<T>
    • java.util.TreeSet<T>

    Supported Map types - for rows mapped to Map.Entry<K, V>

    • java.util.Map<K, V>
    • java.util.HashMap<K, V>
    • java.util.LinkedHashMap<K, V>
    • java.util.SortedMap<K, V>
    • java.util.TreeMap<K, V>
    • java.util.concurrent.ConcurrentMap<K, V>
    • java.util.concurrent.ConcurrentHashMap<K, V>
    • java.util.WeakHashMap<K, V>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.List<CollectorFactory> FACTORIES
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean accepts​(java.lang.reflect.Type containerType)
      Deprecated.
      Accept a Type as a collector.
      java.util.stream.Collector<?,​?,​?> build​(java.lang.reflect.Type containerType)
      Deprecated.
      Creates a collector for a given container type.
      private static <K,​V,​M extends java.util.Map<K,​V>>
      M
      combine​(M a, M b)
      Deprecated.
       
      java.util.Optional<java.lang.reflect.Type> elementType​(java.lang.reflect.Type containerType)
      Deprecated.
      Returns the element type for a given container type.
      private static <K,​V,​M extends java.util.Map<K,​V>>
      void
      putEntry​(M map, java.util.Map.Entry<K,​V> entry)
      Deprecated.
       
      private static <K,​V,​M extends java.util.Map<K,​V>>
      void
      putEntry​(M map, K key, V value)
      Deprecated.
       
      static <K,​V,​M extends java.util.Map<K,​V>>
      java.util.stream.Collector<java.util.Map.Entry<K,​V>,​?,​M>
      toMap​(java.util.function.Supplier<M> mapFactory)
      Deprecated.
      static <T> java.util.stream.Collector<T,​?,​java.util.Optional<T>> toOptional()
      Deprecated.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FACTORIES

        private static final java.util.List<CollectorFactory> FACTORIES
        Deprecated.
    • Constructor Detail

      • BuiltInCollectorFactory

        public BuiltInCollectorFactory()
        Deprecated.
    • Method Detail

      • accepts

        public boolean accepts​(java.lang.reflect.Type containerType)
        Deprecated.
        Description copied from interface: CollectorFactory
        Accept a Type as a collector.
        Specified by:
        accepts in interface CollectorFactory
        Parameters:
        containerType - the container type.
        Returns:
        whether this factory can produce a collector for the given container type.
      • elementType

        public java.util.Optional<java.lang.reflect.Type> elementType​(java.lang.reflect.Type containerType)
        Deprecated.
        Description copied from interface: CollectorFactory
        Returns the element type for a given container type.
        Specified by:
        elementType in interface CollectorFactory
        Parameters:
        containerType - the container type.
        Returns:
        the container element type if it can be discovered through reflection; empty otherwise.
        See Also:
        StatementContext.findElementTypeFor(Type)
      • toOptional

        @Deprecated
        public static <T> java.util.stream.Collector<T,​?,​java.util.Optional<T>> toOptional()
        Deprecated.
        Returns a Collector that accumulates 0 or 1 input elements into an Optional<T>. The returned collector will throw IllegalStateException whenever 2 or more elements are present in a stream.
        Type Parameters:
        T - the collected type
        Returns:
        a Collector which collects 0 or 1 input elements into an Optional<T>.
      • toMap

        @Deprecated
        public static <K,​V,​M extends java.util.Map<K,​V>> java.util.stream.Collector<java.util.Map.Entry<K,​V>,​?,​M> toMap​(java.util.function.Supplier<M> mapFactory)
        Deprecated.
        Returns a Collector that accumulates Map.Entry<K, V> input elements into a map of the supplied type. The returned collector will throw IllegalStateException whenever a set of input elements contains multiple entries with the same key.
        Type Parameters:
        K - the type of map keys
        V - the type of map values
        M - the type of the resulting Map
        Parameters:
        mapFactory - a Supplier which returns a new, empty Map of the appropriate type.
        Returns:
        a Collector which collects map entry elements into a Map, in encounter order.
      • putEntry

        private static <K,​V,​M extends java.util.Map<K,​V>> void putEntry​(M map,
                                                                                          java.util.Map.Entry<K,​V> entry)
        Deprecated.
      • putEntry

        private static <K,​V,​M extends java.util.Map<K,​V>> void putEntry​(M map,
                                                                                          K key,
                                                                                          V value)
        Deprecated.
      • combine

        private static <K,​V,​M extends java.util.Map<K,​V>> M combine​(M a,
                                                                                      M b)
        Deprecated.