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>
AProjectionAccumulatorthat 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 Faccumulate(F accumulated, F value)Folds a new value in the given accumulated container.FcreateInitial()Creates the initial accumulated container.Vfinish(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()StringtoString()
-
-
-
Method Detail
-
provider
public static <V> ProjectionAccumulator.Provider<V,V> provider()
-
createInitial
public F createInitial()
Description copied from interface:ProjectionAccumulatorCreates the initial accumulated container.This operation should be non-blocking.
- Specified by:
createInitialin 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:ProjectionAccumulatorFolds a new value in the given accumulated container.This operation should be non-blocking.
- Specified by:
accumulatein 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:ProjectionAccumulatorFinishes the collecting, converting the accumulated container into the final result.This operation may be blocking.
- Specified by:
finishin 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 (fromFtoV).context- The context to be passed to the projection converter.- Returns:
- The final result of the collecting.
-
-