public interface SearchPredicateFactoryExtensionContext
SearchPredicateFactoryContext
.Modifier and Type | Method and Description |
---|---|
<T> SearchPredicateFactoryExtensionContext |
ifSupported(SearchPredicateFactoryContextExtension<T> extension,
Function<T,? extends SearchPredicateTerminalContext> predicateContributor)
If the given extension is supported, and none of the previous extensions passed to
ifSupported(SearchPredicateFactoryContextExtension, Function)
was supported, extend the current context with this extension,
apply the given function to the extended context, and store the resulting predicate for later retrieval. |
SearchPredicateTerminalContext |
orElse(Function<SearchPredicateFactoryContext,? extends SearchPredicateTerminalContext> predicateContributor)
If no extension passed to
ifSupported(SearchPredicateFactoryContextExtension, Function)
was supported so far, apply the given consumer to the current (non-extended) SearchPredicateFactoryContext ;
otherwise return the predicate created in the first succeeding ifSupported call. |
SearchPredicateTerminalContext |
orElseFail()
If no extension passed to
ifSupported(SearchPredicateFactoryContextExtension, Function)
was supported so far, throw an exception;
otherwise return the predicate created in the first succeeding ifSupported call. |
<T> SearchPredicateFactoryExtensionContext ifSupported(SearchPredicateFactoryContextExtension<T> extension, Function<T,? extends SearchPredicateTerminalContext> predicateContributor)
ifSupported(SearchPredicateFactoryContextExtension, Function)
was supported, extend the current context with this extension,
apply the given function to the extended context, and store the resulting predicate for later retrieval.
This method cannot be called after orElse(Function)
or orElseFail()
.
T
- The type of the extended context.extension
- The extension to apply.predicateContributor
- A function called if the extension is successfully applied;
it will use the (extended) DSL context passed in parameter to create a predicate,
returning the resulting terminal context.
Should generally be a lambda expression.this
, for method chaining.SearchPredicateTerminalContext orElse(Function<SearchPredicateFactoryContext,? extends SearchPredicateTerminalContext> predicateContributor)
ifSupported(SearchPredicateFactoryContextExtension, Function)
was supported so far, apply the given consumer to the current (non-extended) SearchPredicateFactoryContext
;
otherwise return the predicate created in the first succeeding ifSupported
call.predicateContributor
- A function called if no extension was successfully applied;
it will use the (extended) DSL context passed in parameter to create a predicate,
returning the resulting terminal context.
Should generally be a lambda expression.SearchPredicateTerminalContext orElseFail()
ifSupported(SearchPredicateFactoryContextExtension, Function)
was supported so far, throw an exception;
otherwise return the predicate created in the first succeeding ifSupported
call.SearchException
- If none of the previously passed extensions was supported.Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.