Class SearchSortFactoryExtensionStep
java.lang.Object
org.hibernate.search.engine.search.sort.dsl.impl.SearchSortFactoryExtensionStep
- All Implemented Interfaces:
SearchSortFactoryExtensionIfSupportedMoreStep,SearchSortFactoryExtensionIfSupportedStep
public final class SearchSortFactoryExtensionStep
extends Object
implements SearchSortFactoryExtensionIfSupportedMoreStep
-
Constructor Summary
ConstructorsConstructorDescriptionSearchSortFactoryExtensionStep(SearchSortFactory parent, SearchSortDslContext<?, ?> dslContext) -
Method Summary
Modifier and TypeMethodDescriptionifSupported(SearchSortFactoryExtension<T> extension, Function<T, ? extends SortFinalStep> sortContributor) If the given extension is supported, and none of the previous extensions passed toSearchSortFactoryExtensionIfSupportedStep.ifSupported(SearchSortFactoryExtension, Function)was supported, extend the current factory with this extension, apply the given function to the extended factory, and store the resulting sort for later retrieval.orElse(Function<SearchSortFactory, ? extends SortFinalStep> sortContributor) If no extension passed toSearchSortFactoryExtensionIfSupportedStep.ifSupported(SearchSortFactoryExtension, Function)was supported so far, apply the given consumer to the current (non-extended)SearchSortFactory; otherwise return the sort created in the first succeedingifSupportedcall.If no extension passed toSearchSortFactoryExtensionIfSupportedStep.ifSupported(SearchSortFactoryExtension, Function)was supported so far, throw an exception; otherwise return the sort created in the first succeedingifSupportedcall.
-
Constructor Details
-
SearchSortFactoryExtensionStep
public SearchSortFactoryExtensionStep(SearchSortFactory parent, SearchSortDslContext<?, ?> dslContext)
-
-
Method Details
-
ifSupported
public <T> SearchSortFactoryExtensionIfSupportedMoreStep ifSupported(SearchSortFactoryExtension<T> extension, Function<T, ? extends SortFinalStep> sortContributor) Description copied from interface:SearchSortFactoryExtensionIfSupportedStepIf the given extension is supported, and none of the previous extensions passed toSearchSortFactoryExtensionIfSupportedStep.ifSupported(SearchSortFactoryExtension, Function)was supported, extend the current factory with this extension, apply the given function to the extended factory, and store the resulting sort for later retrieval.This method cannot be called after
SearchSortFactoryExtensionIfSupportedMoreStep.orElse(Function)orSearchSortFactoryExtensionIfSupportedMoreStep.orElseFail().- Specified by:
ifSupportedin interfaceSearchSortFactoryExtensionIfSupportedStep- Type Parameters:
T- The type of the extended factory.- Parameters:
extension- The extension to apply.sortContributor- A function called if the extension is successfully applied; it will use the (extended) sort factory passed in parameter to create a sort, returning the final step in the sort DSL. Should generally be a lambda expression.- Returns:
this, for method chaining.
-
orElse
Description copied from interface:SearchSortFactoryExtensionIfSupportedMoreStepIf no extension passed toSearchSortFactoryExtensionIfSupportedStep.ifSupported(SearchSortFactoryExtension, Function)was supported so far, apply the given consumer to the current (non-extended)SearchSortFactory; otherwise return the sort created in the first succeedingifSupportedcall.- Specified by:
orElsein interfaceSearchSortFactoryExtensionIfSupportedMoreStep- Parameters:
sortContributor- A function called if no extension was successfully applied; it will use the (non-extended) sort factory passed in parameter to create a sort, returning the final step in the sort DSL. Should generally be a lambda expression.- Returns:
- The final step in the DSL of the resulting sort.
-
orElseFail
Description copied from interface:SearchSortFactoryExtensionIfSupportedMoreStepIf no extension passed toSearchSortFactoryExtensionIfSupportedStep.ifSupported(SearchSortFactoryExtension, Function)was supported so far, throw an exception; otherwise return the sort created in the first succeedingifSupportedcall.- Specified by:
orElseFailin interfaceSearchSortFactoryExtensionIfSupportedMoreStep- Returns:
- The final step in the DSL of the resulting sort.
-