Class SingleValuedProjectionAccumulator<F,V>
- java.lang.Object
-
- org.hibernate.search.engine.search.projection.spi.SingleValuedProjectionAccumulator<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,F,V>
public final class SingleValuedProjectionAccumulator<F,V> extends Object implements ProjectionAccumulator<F,V,F,V>
AProjectionAccumulator
that can accumulate up to one value, and will throw an exception beyond that.
-
-
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 F
accumulate(F accumulated, F value)
Folds a new value in the given accumulated container.F
createInitial()
Creates the initial accumulated container.V
finish(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,V>
provider()
String
toString()
-
-
-
Method Detail
-
provider
public static <V> ProjectionAccumulator.Provider<V,V> provider()
-
createInitial
public 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,F,V>
- Returns:
- The initial accumulated container,
to pass to the first call to
ProjectionAccumulator.accumulate(Object, Object)
.
-
accumulate
public F accumulate(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,F,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 V finish(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,F,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.
-
-