R
- The type of references in the parent SearchProjectionFactoryContext
.O
- The type of loaded objects in the parent SearchProjectionFactoryContext
.P
- The resulting projection type.public interface SearchProjectionFactoryExtensionContext<P,R,O>
SearchProjectionFactoryContext
.Modifier and Type | Method and Description |
---|---|
<T> SearchProjectionFactoryExtensionContext<P,R,O> |
ifSupported(SearchProjectionFactoryContextExtension<T,R,O> extension,
Function<T,? extends SearchProjectionTerminalContext<P>> projectionContributor)
If the given extension is supported, and none of the previous extensions passed to
ifSupported(SearchProjectionFactoryContextExtension, Function)
was supported, extend the current context with this extension,
apply the given function to the extended context, and store the resulting projection for later retrieval. |
SearchProjectionTerminalContext<P> |
orElse(Function<SearchProjectionFactoryContext<R,O>,? extends SearchProjectionTerminalContext<P>> projectionContributor)
If no extension passed to
ifSupported(SearchProjectionFactoryContextExtension, Function)
was supported so far, apply the given function to the current (non-extended) SearchProjectionFactoryContext ;
otherwise return the projection created in the first succeeding ifSupported call. |
SearchProjectionTerminalContext<P> |
orElseFail()
If no extension passed to
ifSupported(SearchProjectionFactoryContextExtension, Function)
was supported so far, throw an exception;
otherwise return the projection created in the first succeeding ifSupported call. |
<T> SearchProjectionFactoryExtensionContext<P,R,O> ifSupported(SearchProjectionFactoryContextExtension<T,R,O> extension, Function<T,? extends SearchProjectionTerminalContext<P>> projectionContributor)
ifSupported(SearchProjectionFactoryContextExtension, Function)
was supported, extend the current context with this extension,
apply the given function to the extended context, and store the resulting projection 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.projectionContributor
- A function called if the extension is successfully applied;
it will use the (extended) DSL context passed in parameter to create a projection,
returning the resulting terminal context.
Should generally be a lambda expression.this
, for method chaining.SearchProjectionTerminalContext<P> orElse(Function<SearchProjectionFactoryContext<R,O>,? extends SearchProjectionTerminalContext<P>> projectionContributor)
ifSupported(SearchProjectionFactoryContextExtension, Function)
was supported so far, apply the given function to the current (non-extended) SearchProjectionFactoryContext
;
otherwise return the projection created in the first succeeding ifSupported
call.projectionContributor
- A function called if no extension was successfully applied;
it will use the (extended) DSL context passed in parameter to create a projection,
returning the resulting terminal context.
Should generally be a lambda expression.SearchProjectionTerminalContext<P> orElseFail()
ifSupported(SearchProjectionFactoryContextExtension, Function)
was supported so far, throw an exception;
otherwise return the projection 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.