Package org.jdbi.v3.vavr
Class VavrCollectorFactory
- java.lang.Object
-
- org.jdbi.v3.vavr.VavrCollectorFactory
-
- All Implemented Interfaces:
CollectorFactory
class VavrCollectorFactory extends java.lang.Object implements CollectorFactory
-
-
Field Summary
Fields Modifier and Type Field Description private io.vavr.collection.Map<java.lang.Class<?>,java.util.stream.Collector<?,?,?>>collectorsprivate io.vavr.collection.Map<java.lang.Class<?>,java.lang.Class<?>>defaultImplementations
-
Constructor Summary
Constructors Constructor Description VavrCollectorFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccepts(java.lang.reflect.Type containerType)Accept aTypeas a collector.java.util.stream.Collector<?,?,?>build(java.lang.reflect.Type containerType)Creates a collector for a given container type.java.util.Optional<java.lang.reflect.Type>elementType(java.lang.reflect.Type containerType)Returns the element type for a given container type.private java.lang.Class<?>getCollectionType(java.lang.reflect.Type containerType)private booleanhasDefaultImplementationWithCollector(java.lang.Class<?> erasedType)private io.vavr.control.Option<java.util.stream.Collector<?,?,?>>resolveDefaultCollector(java.lang.Class<?> erasedType)private static java.lang.reflect.TyperesolveMaplikeEntryType(java.lang.reflect.Type maplikeType, java.lang.Class<?> maplikeClass)
-
-
-
Method Detail
-
accepts
public boolean accepts(java.lang.reflect.Type containerType)
Description copied from interface:CollectorFactoryAccept aTypeas a collector.- Specified by:
acceptsin interfaceCollectorFactory- Parameters:
containerType- the container type.- Returns:
- whether this factory can produce a collector for the given container type.
-
getCollectionType
private java.lang.Class<?> getCollectionType(java.lang.reflect.Type containerType)
-
hasDefaultImplementationWithCollector
private boolean hasDefaultImplementationWithCollector(java.lang.Class<?> erasedType)
-
resolveDefaultCollector
private io.vavr.control.Option<java.util.stream.Collector<?,?,?>> resolveDefaultCollector(java.lang.Class<?> erasedType)
-
elementType
public java.util.Optional<java.lang.reflect.Type> elementType(java.lang.reflect.Type containerType)
Description copied from interface:CollectorFactoryReturns the element type for a given container type.- Specified by:
elementTypein interfaceCollectorFactory- Parameters:
containerType- the container type.- Returns:
- the container element type if it can be discovered through reflection; empty otherwise.
- See Also:
StatementContext.findElementTypeFor(Type)
-
build
public java.util.stream.Collector<?,?,?> build(java.lang.reflect.Type containerType)
Description copied from interface:CollectorFactoryCreates a collector for a given container type.- Specified by:
buildin interfaceCollectorFactory- Parameters:
containerType- the container type.- Returns:
- a
Collectorfor the given container type. - See Also:
StatementContext.findCollectorFor(Type),JdbiCollectors.findFor(Type)
-
resolveMaplikeEntryType
private static java.lang.reflect.Type resolveMaplikeEntryType(java.lang.reflect.Type maplikeType, java.lang.Class<?> maplikeClass)
-
-