Package com.forgerock.reactive
Class ReactiveFilter<C,I1,O1,I2,O2>
- java.lang.Object
-
- com.forgerock.reactive.ReactiveFilter<C,I1,O1,I2,O2>
-
- Type Parameters:
C- Context in which the filter will be evaluatedI1- Type of the request received by this filterO1- Type of the response answered by this filterI2- Type of the request emitted to the handler/next filterO2- Type of the response emitted by the handler/next filter
- Direct Known Subclasses:
ReactiveFilter.SimpleReactiveFilter
public abstract class ReactiveFilter<C,I1,O1,I2,O2> extends Object
Filters and/or transforms the request and/or response of an exchange.+--------+ +---------+ ---> I1 ---> | | ---> I2 ---> | | | Filter | | Handler | <--- O1 --< | | <--- O2 <--- | | +--------+ +---------+ +--------+ +---------+ +---------+ ---> I1 ---> | One | ---> I2 ---> | AndThen | ---> I3 ---> | | | Filter | | Filter | | Handler | <--- O1 --< | | <--- O2 <--- | | <--- O3 ---< | | +--------+ +---------+ +---------+
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReactiveFilter.SimpleReactiveFilter<C,I,O>A simpleReactiveHandlerperforming simple filtering without type transformation.
-
Constructor Summary
Constructors Constructor Description ReactiveFilter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ReactiveFilter<C,I1,O1,I2,O2>andThen(boolean condition, ReactiveFilter<C,I2,O2,I2,O2> next)Optionally concatenate a new filter to this filter.ReactiveFilter<C,I1,O1,I2,O2>andThen(ReactiveFilter.SimpleReactiveFilter<C,I2,O2> next)Add a new filtering step after this one.<I3,O3>
ReactiveFilter<C,I1,O1,I3,O3>andThen(ReactiveFilter<C,I2,O2,I3,O3> next)Concatenate a transformer filter to this filter.ReactiveHandler<C,I1,O1>andThen(ReactiveHandler<C,I2,O2> handler)Terminate the filter chain with the specified handler.abstract O1filter(C context, I1 request, ReactiveHandler<C,I2,O2> next)Perform the request and/or response filtering and/or transformation.
-
-
-
Method Detail
-
andThen
public ReactiveFilter<C,I1,O1,I2,O2> andThen(boolean condition, ReactiveFilter<C,I2,O2,I2,O2> next)
Optionally concatenate a new filter to this filter.- Parameters:
condition- If true, next will be concatenated to this filternext- The filter to optionally concatenate with this one- Returns:
- If condition is true, returns the concatenation of this filter and next. Otherwise, return this filter.
-
andThen
public <I3,O3> ReactiveFilter<C,I1,O1,I3,O3> andThen(ReactiveFilter<C,I2,O2,I3,O3> next)
Concatenate a transformer filter to this filter.- Type Parameters:
I3- Target type of the request transformed by the filterO3- Source type of the response transformed by the filter- Parameters:
next- The transformer filter to add after this filter.- Returns:
- A new
ReactiveFilterresults of the concatenation of this filter and the transformer filter
-
andThen
public ReactiveFilter<C,I1,O1,I2,O2> andThen(ReactiveFilter.SimpleReactiveFilter<C,I2,O2> next)
Add a new filtering step after this one.- Parameters:
next- The filter to add after this one- Returns:
- A new
ReactiveFilterresult of the concatenation of this filter and next
-
andThen
public ReactiveHandler<C,I1,O1> andThen(ReactiveHandler<C,I2,O2> handler)
Terminate the filter chain with the specified handler.- Parameters:
handler-ReactiveHandlerin charge of processing the request- Returns:
- A new
ReactiveHandlerresults of the concatenation of this filter and handler
-
filter
public abstract O1 filter(C context, I1 request, ReactiveHandler<C,I2,O2> next) throws Exception
Perform the request and/or response filtering and/or transformation.- Parameters:
context- Context of the filtering/transformationrequest- Request to filternext-ReactiveHandlerto call once the filtering/transformation is done- Returns:
- The filtered and/or transformed response
- Throws:
Exception- If the operation cannot be done
-
-