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,SearchProjection<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. |
SearchProjection<P> |
orElse(Function<SearchProjectionFactoryContext<R,O>,SearchProjection<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. |
SearchProjection<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,SearchProjection<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 that will use the (extended) context passed in parameter to create a SearchProjection
,
if the extension is successfully applied.
Should generally be a lambda expression.this
, for method chaining.SearchProjection<P> orElse(Function<SearchProjectionFactoryContext<R,O>,SearchProjection<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 that will use the (non-extended) context passed in parameter to create a SearchProjection
,
if the extension is successfully applied.
Should generally be a lambda expression.SearchProjection<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.