Class ListProjectionAccumulator<F,V>
- java.lang.Object
-
- org.hibernate.search.engine.search.projection.spi.ListProjectionAccumulator<F,V>
-
- Type Parameters:
F
- The type of (unconverted) field values.V
- The type of field values after the projection converter was applied.
- All Implemented Interfaces:
ProjectionAccumulator<F,V,List<F>,List<V>>
public final class ListProjectionAccumulator<F,V> extends Object implements ProjectionAccumulator<F,V,List<F>,List<V>>
AProjectionAccumulator
that can accumulate any number of values into aList
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.search.engine.search.projection.spi.ProjectionAccumulator
ProjectionAccumulator.Provider<V,R>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<F>
accumulate(List<F> accumulated, F value)
Folds a new value in the given accumulated container.List<F>
createInitial()
Creates the initial accumulated container.List<V>
finish(List<F> accumulated, ProjectionConverter<? super F,? extends V> converter, FromDocumentValueConvertContext context)
Finishes the collecting, converting the accumulated container into the final result.static <V> ProjectionAccumulator.Provider<V,List<V>>
provider()
String
toString()
-
-
-
Method Detail
-
provider
public static <V> ProjectionAccumulator.Provider<V,List<V>> provider()
-
createInitial
public List<F> createInitial()
Description copied from interface:ProjectionAccumulator
Creates the initial accumulated container.This operation should be non-blocking.
- Specified by:
createInitial
in interfaceProjectionAccumulator<F,V,List<F>,List<V>>
- Returns:
- The initial accumulated container,
to pass to the first call to
ProjectionAccumulator.accumulate(Object, Object)
.
-
accumulate
public List<F> accumulate(List<F> accumulated, F value)
Description copied from interface:ProjectionAccumulator
Folds a new value in the given accumulated container.This operation should be non-blocking.
- Specified by:
accumulate
in interfaceProjectionAccumulator<F,V,List<F>,List<V>>
- Parameters:
accumulated
- The accumulated value so far. For the first call, this is a value returned byProjectionAccumulator.createInitial()
. For the next calls, this is the value returned by the previous call toProjectionAccumulator.accumulate(Object, Object)
.value
- The value to accumulate.- Returns:
- The new accumulated value.
-
finish
public List<V> finish(List<F> accumulated, ProjectionConverter<? super F,? extends V> converter, FromDocumentValueConvertContext context)
Description copied from interface:ProjectionAccumulator
Finishes the collecting, converting the accumulated container into the final result.This operation may be blocking.
- Specified by:
finish
in interfaceProjectionAccumulator<F,V,List<F>,List<V>>
- Parameters:
accumulated
- The temporary storage created byProjectionAccumulator.createInitial()
and populated by successive calls toProjectionAccumulator.accumulate(Object, Object)
.converter
- The projection converter (fromF
toV
).context
- The context to be passed to the projection converter.- Returns:
- The final result of the collecting.
-
-