Class SearchPredicateFactoryExtensionStep
- java.lang.Object
-
- org.hibernate.search.engine.search.predicate.dsl.impl.SearchPredicateFactoryExtensionStep
-
- All Implemented Interfaces:
SearchPredicateFactoryExtensionIfSupportedMoreStep,SearchPredicateFactoryExtensionIfSupportedStep
public final class SearchPredicateFactoryExtensionStep extends Object implements SearchPredicateFactoryExtensionIfSupportedStep, SearchPredicateFactoryExtensionIfSupportedMoreStep
-
-
Constructor Summary
Constructors Constructor Description SearchPredicateFactoryExtensionStep(SearchPredicateFactory parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> SearchPredicateFactoryExtensionIfSupportedMoreStepifSupported(SearchPredicateFactoryExtension<T> extension, Function<T,? extends PredicateFinalStep> predicateContributor)If the given extension is supported, and none of the previous extensions passed toSearchPredicateFactoryExtensionIfSupportedStep.ifSupported(SearchPredicateFactoryExtension, Function)was supported, extend the current factory with this extension, apply the given function to the extended factory, and store the resulting predicate for later retrieval.PredicateFinalSteporElse(Function<SearchPredicateFactory,? extends PredicateFinalStep> predicateContributor)If no extension passed toSearchPredicateFactoryExtensionIfSupportedStep.ifSupported(SearchPredicateFactoryExtension, Function)was supported so far, apply the given consumer to the current (non-extended)SearchPredicateFactory; otherwise return the predicate created in the first succeedingifSupportedcall.PredicateFinalSteporElseFail()If no extension passed toSearchPredicateFactoryExtensionIfSupportedStep.ifSupported(SearchPredicateFactoryExtension, Function)was supported so far, throw an exception; otherwise return the predicate created in the first succeedingifSupportedcall.
-
-
-
Constructor Detail
-
SearchPredicateFactoryExtensionStep
public SearchPredicateFactoryExtensionStep(SearchPredicateFactory parent)
-
-
Method Detail
-
ifSupported
public <T> SearchPredicateFactoryExtensionIfSupportedMoreStep ifSupported(SearchPredicateFactoryExtension<T> extension, Function<T,? extends PredicateFinalStep> predicateContributor)
Description copied from interface:SearchPredicateFactoryExtensionIfSupportedStepIf the given extension is supported, and none of the previous extensions passed toSearchPredicateFactoryExtensionIfSupportedStep.ifSupported(SearchPredicateFactoryExtension, Function)was supported, extend the current factory with this extension, apply the given function to the extended factory, and store the resulting predicate for later retrieval.This method cannot be called after
SearchPredicateFactoryExtensionIfSupportedMoreStep.orElse(Function)orSearchPredicateFactoryExtensionIfSupportedMoreStep.orElseFail().- Specified by:
ifSupportedin interfaceSearchPredicateFactoryExtensionIfSupportedStep- Type Parameters:
T- The type of the extended factory.- Parameters:
extension- The extension to apply.predicateContributor- A function called if the extension is successfully applied; it will use the (extended) predicate factory passed in parameter to create a predicate, returning the final step in the predicate DSL. Should generally be a lambda expression.- Returns:
- The next step.
-
orElse
public PredicateFinalStep orElse(Function<SearchPredicateFactory,? extends PredicateFinalStep> predicateContributor)
Description copied from interface:SearchPredicateFactoryExtensionIfSupportedMoreStepIf no extension passed toSearchPredicateFactoryExtensionIfSupportedStep.ifSupported(SearchPredicateFactoryExtension, Function)was supported so far, apply the given consumer to the current (non-extended)SearchPredicateFactory; otherwise return the predicate created in the first succeedingifSupportedcall.- Specified by:
orElsein interfaceSearchPredicateFactoryExtensionIfSupportedMoreStep- Parameters:
predicateContributor- A function called if no extension was successfully applied; it will use the (non-extended) predicate factory passed in parameter to create a predicate, returning the final step in the predicate DSL. Should generally be a lambda expression.- Returns:
- The final step in the DSL of the resulting predicate.
-
orElseFail
public PredicateFinalStep orElseFail()
Description copied from interface:SearchPredicateFactoryExtensionIfSupportedMoreStepIf no extension passed toSearchPredicateFactoryExtensionIfSupportedStep.ifSupported(SearchPredicateFactoryExtension, Function)was supported so far, throw an exception; otherwise return the predicate created in the first succeedingifSupportedcall.- Specified by:
orElseFailin interfaceSearchPredicateFactoryExtensionIfSupportedMoreStep- Returns:
- The final step in the DSL of the resulting predicate.
-
-