public abstract class SearchExpressionHandlerWrapper extends SearchExpressionHandler implements FacesWrapper<SearchExpressionHandler>
Provides a simple implementation of SearchExpressionHandler
that can
be subclassed by developers wishing to provide specialized behavior
to an existing SearchExpressionHandler
instance. The default
implementation of all methods is to call through to the wrapped
SearchExpressionHandler
instance.
Usage: extend this class and push the implementation being wrapped to the
constructor and use getWrapped()
to access the instance being wrapped.
EXPRESSION_SEPARATOR_CHARS, KEYWORD_PREFIX
Constructor and Description |
---|
SearchExpressionHandlerWrapper(SearchExpressionHandler wrapped)
If this search expression handler has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor. |
Modifier and Type | Method and Description |
---|---|
char[] |
getExpressionSeperatorChars(FacesContext context)
Return the characters used to separate expressions in a series of expressions. |
SearchExpressionHandler |
getWrapped()
A class that implements this interface uses this method to return an instance of the class being wrapped. |
void |
invokeOnComponent(SearchExpressionContext searchExpressionContext,
String expression,
ContextCallback callback)
Resolves multiple |
void |
invokeOnComponent(SearchExpressionContext searchExpressionContext,
UIComponent previous,
String expression,
ContextCallback callback)
Resolves multiple |
boolean |
isPassthroughExpression(SearchExpressionContext searchExpressionContext,
String expression)
Checks if the given expression is a "passtrough expression". |
boolean |
isValidExpression(SearchExpressionContext searchExpressionContext,
String expression)
Checks if the given expression is a valid expression. |
String |
resolveClientId(SearchExpressionContext searchExpressionContext,
String expression)
Resolves to a single clientId or passthrough expression for the given expression. |
List<String> |
resolveClientIds(SearchExpressionContext searchExpressionContext,
String expressions)
Resolves to a |
void |
resolveComponent(SearchExpressionContext searchExpressionContext,
String expression,
ContextCallback callback)
Resolves a single |
void |
resolveComponents(SearchExpressionContext searchExpressionContext,
String expressions,
ContextCallback callback)
Resolves multiple |
String[] |
splitExpressions(FacesContext context,
String expressions)
Splits an string, based on
|
public SearchExpressionHandlerWrapper(SearchExpressionHandler wrapped)
If this search expression handler has been decorated,
the implementation doing the decorating should push the implementation being wrapped to this constructor.
The getWrapped()
will then return the implementation being wrapped.
wrapped
- The implementation being wrapped.public SearchExpressionHandler getWrapped()
FacesWrapper
A class that implements this interface uses this method to return an instance of the class being wrapped.
getWrapped
in interface FacesWrapper<SearchExpressionHandler>
public String resolveClientId(SearchExpressionContext searchExpressionContext, String expression)
SearchExpressionHandler
Resolves to a single clientId or passthrough expression for the given expression.
resolveClientId
in class SearchExpressionHandler
searchExpressionContext
- the SearchExpressionContext
expression
- the search expressionSearchExpressionHint.IGNORE_NO_RESULT
was passed, null
will be returned.public List<String> resolveClientIds(SearchExpressionContext searchExpressionContext, String expressions)
SearchExpressionHandler
Resolves to a List
with clientIds or passthrough expressions for the given expressions.
The expressions will be splitted by SearchExpressionHandler.splitExpressions(javax.faces.context.FacesContext, java.lang.String)
and resolved one by one.
resolveClientIds
in class SearchExpressionHandler
searchExpressionContext
- the SearchExpressionContext
expressions
- the search expressionspublic void resolveComponent(SearchExpressionContext searchExpressionContext, String expression, ContextCallback callback)
SearchExpressionHandler
Resolves a single UIComponent
s for the given
expression. If the component is resolved, the ContextCallback
will be invoked.
resolveComponent
in class SearchExpressionHandler
searchExpressionContext
- the SearchExpressionContext
expression
- the search expressioncallback
- the callback for the resolved componentpublic void resolveComponents(SearchExpressionContext searchExpressionContext, String expressions, ContextCallback callback)
SearchExpressionHandler
Resolves multiple UIComponent
s for the given expression(s).
The expressions will be splitted by SearchExpressionHandler.splitExpressions(javax.faces.context.FacesContext, java.lang.String)
and resolved one by one.
For each resolved component, the ContextCallback
will be invoked.
resolveComponents
in class SearchExpressionHandler
searchExpressionContext
- the SearchExpressionContext
expressions
- the search expression(s)callback
- the callback for each resolved componentpublic void invokeOnComponent(SearchExpressionContext searchExpressionContext, String expression, ContextCallback callback)
SearchExpressionHandler
Resolves multiple UIComponent
s for the given
expression. For each resolved component, the ContextCallback
will be invoked.
This method is the most essential method in the API.
It implements the algorithm which handles the recursion of the keywords and id's.
invokeOnComponent
in class SearchExpressionHandler
searchExpressionContext
- the SearchExpressionContext
expression
- the search expressioncallback
- the callback for the resolved componentpublic void invokeOnComponent(SearchExpressionContext searchExpressionContext, UIComponent previous, String expression, ContextCallback callback)
SearchExpressionHandler
Resolves multiple UIComponent
s for the given
expression. For each resolved component, the ContextCallback
will be invoked.
This method is the most essential method in the API.
It implements the algorithm which handles the recursion of the keywords and id's.
invokeOnComponent
in class SearchExpressionHandler
searchExpressionContext
- the SearchExpressionContext
previous
- The previous resolved component, that will be the base for searchingexpression
- the search expressioncallback
- the callback for the resolved componentpublic boolean isValidExpression(SearchExpressionContext searchExpressionContext, String expression)
SearchExpressionHandler
Checks if the given expression is a valid expression.
SearchKeywordResolver
matches the requested keywordisValidExpression
in class SearchExpressionHandler
searchExpressionContext
- the SearchExpressionContext
expression
- the expressionpublic boolean isPassthroughExpression(SearchExpressionContext searchExpressionContext, String expression)
SearchExpressionHandler
Checks if the given expression is a "passtrough expression".
A passthrough expression must only be a keyword.
This keyword will not be resolved by the SearchKeywordResolver
and will be returned untouched.
The client is responsible to resolve it later.
isPassthroughExpression
in class SearchExpressionHandler
searchExpressionContext
- the SearchExpressionContext
expression
- the expressionpublic String[] splitExpressions(FacesContext context, String expressions)
SearchExpressionHandler
Splits an string, based on
SearchExpressionHandler.getExpressionSeperatorChars(javax.faces.context.FacesContext)
with possible multiple expressions into an array.
splitExpressions
in class SearchExpressionHandler
context
- the FacesContext
for the current requestexpressions
- The expressions as stringpublic char[] getExpressionSeperatorChars(FacesContext context)
SearchExpressionHandler
Return the characters used to separate expressions
in a series of expressions.
The default implementation returns SearchExpressionHandler.EXPRESSION_SEPARATOR_CHARS
.
getExpressionSeperatorChars
in class SearchExpressionHandler
context
- the FacesContext
for the current requestCopyright © 2019 JBoss by Red Hat. All rights reserved.