ResultIterableReturner(QualifiedType<?> returnType) { // extract T from Query<T> elementType = returnType.mapType(type -> GenericTypes.findGenericParameter(type, ResultIterable.class)) .orElseThrow(() -> new IllegalStateException( "Cannot reflect ResultIterable<T> element type T in method return type " + returnType)); }
@Override protected QualifiedType<?> elementType(StatementContext ctx) { // if returnType is not supported by a collector factory, assume it to be a single-value return type. return returnType.mapType(type -> ctx.findElementTypeFor(type)) .orElse(returnType); } }
StreamReturner(QualifiedType<?> returnType) { elementType = returnType.mapType(type -> GenericTypes.findGenericParameter(type, Stream.class)) .orElseThrow(() -> new IllegalStateException( "Cannot reflect Stream<T> element type T in method return type " + returnType)); }
ResultIteratorReturner(QualifiedType<?> returnType) { this.elementType = returnType.mapType(type -> GenericTypes.findGenericParameter(type, Iterator.class)) .orElseThrow(() -> new IllegalStateException( "Cannot reflect ResultIterator<T> element type T in method return type " + returnType)); }
IteratorReturner(QualifiedType<?> returnType) { this.elementType = returnType.mapType(type -> GenericTypes.findGenericParameter(type, Iterator.class)) .orElseThrow(() -> new IllegalStateException( "Cannot reflect Iterator<T> element type T in method return type " + returnType)); }