Class SearchProjectionFactoryExtensionStep<P,R,E>
- java.lang.Object
-
- org.hibernate.search.engine.search.projection.dsl.impl.SearchProjectionFactoryExtensionStep<P,R,E>
-
- All Implemented Interfaces:
SearchProjectionFactoryExtensionIfSupportedMoreStep<P,R,E>,SearchProjectionFactoryExtensionIfSupportedStep<P,R,E>
public final class SearchProjectionFactoryExtensionStep<P,R,E> extends Object implements SearchProjectionFactoryExtensionIfSupportedMoreStep<P,R,E>
-
-
Constructor Summary
Constructors Constructor Description SearchProjectionFactoryExtensionStep(SearchProjectionFactory<R,E> parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> SearchProjectionFactoryExtensionIfSupportedMoreStep<P,R,E>ifSupported(SearchProjectionFactoryExtension<T,R,E> extension, Function<T,? extends ProjectionFinalStep<P>> projectionContributor)If the given extension is supported, and none of the previous extensions passed toSearchProjectionFactoryExtensionIfSupportedStep.ifSupported(SearchProjectionFactoryExtension, Function)was supported, extend the current factory with this extension, apply the given function to the extended factory, and store the resulting projection for later retrieval.ProjectionFinalStep<P>orElse(Function<SearchProjectionFactory<R,E>,? extends ProjectionFinalStep<P>> projectionContributor)If no extension passed toSearchProjectionFactoryExtensionIfSupportedStep.ifSupported(SearchProjectionFactoryExtension, Function)was supported so far, apply the given function to the current (non-extended)SearchProjectionFactory; otherwise return the projection created in the first succeedingifSupportedcall.ProjectionFinalStep<P>orElseFail()If no extension passed toSearchProjectionFactoryExtensionIfSupportedStep.ifSupported(SearchProjectionFactoryExtension, Function)was supported so far, throw an exception; otherwise return the projection created in the first succeedingifSupportedcall.
-
-
-
Constructor Detail
-
SearchProjectionFactoryExtensionStep
public SearchProjectionFactoryExtensionStep(SearchProjectionFactory<R,E> parent)
-
-
Method Detail
-
ifSupported
public <T> SearchProjectionFactoryExtensionIfSupportedMoreStep<P,R,E> ifSupported(SearchProjectionFactoryExtension<T,R,E> extension, Function<T,? extends ProjectionFinalStep<P>> projectionContributor)
Description copied from interface:SearchProjectionFactoryExtensionIfSupportedStepIf the given extension is supported, and none of the previous extensions passed toSearchProjectionFactoryExtensionIfSupportedStep.ifSupported(SearchProjectionFactoryExtension, Function)was supported, extend the current factory with this extension, apply the given function to the extended factory, and store the resulting projection for later retrieval.This method cannot be called after
SearchProjectionFactoryExtensionIfSupportedMoreStep.orElse(Function)orSearchProjectionFactoryExtensionIfSupportedMoreStep.orElseFail().- Specified by:
ifSupportedin interfaceSearchProjectionFactoryExtensionIfSupportedStep<P,R,E>- Type Parameters:
T- The type of the extended factory.- Parameters:
extension- The extension to apply.projectionContributor- A function called if the extension is successfully applied; it will use the (extended) projection factory passed in parameter to create a projection, returning the final step in the projection DSL. Should generally be a lambda expression.- Returns:
this, for method chaining.
-
orElse
public ProjectionFinalStep<P> orElse(Function<SearchProjectionFactory<R,E>,? extends ProjectionFinalStep<P>> projectionContributor)
Description copied from interface:SearchProjectionFactoryExtensionIfSupportedMoreStepIf no extension passed toSearchProjectionFactoryExtensionIfSupportedStep.ifSupported(SearchProjectionFactoryExtension, Function)was supported so far, apply the given function to the current (non-extended)SearchProjectionFactory; otherwise return the projection created in the first succeedingifSupportedcall.- Specified by:
orElsein interfaceSearchProjectionFactoryExtensionIfSupportedMoreStep<P,R,E>- Parameters:
projectionContributor- A function called if no extension was successfully applied; it will use the (non-extended) projection factory passed in parameter to create a projection, returning the final step in the projection DSL. Should generally be a lambda expression.- Returns:
- The created projection.
-
orElseFail
public ProjectionFinalStep<P> orElseFail()
Description copied from interface:SearchProjectionFactoryExtensionIfSupportedMoreStepIf no extension passed toSearchProjectionFactoryExtensionIfSupportedStep.ifSupported(SearchProjectionFactoryExtension, Function)was supported so far, throw an exception; otherwise return the projection created in the first succeedingifSupportedcall.- Specified by:
orElseFailin interfaceSearchProjectionFactoryExtensionIfSupportedMoreStep<P,R,E>- Returns:
- The created projection.
-
-