- All Implemented Interfaces:
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.
- Since:
- 2.3
-
Field Summary
Fields inherited from class jakarta.faces.component.search.SearchExpressionHandler
EXPRESSION_SEPARATOR_CHARS, KEYWORD_PREFIX
-
Constructor Summary
ConstructorDescriptionIf this search expression handler has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor. -
Method Summary
Modifier and TypeMethodDescriptionchar[]
getExpressionSeperatorChars
(FacesContext context) Return the characters used to separate expressions in a series of expressions.A class that implements this interface uses this method to return an instance of the class being wrapped.void
invokeOnComponent
(SearchExpressionContext searchExpressionContext, UIComponent previous, String expression, ContextCallback callback) Resolves multipleUIComponent
s for the given expression.void
invokeOnComponent
(SearchExpressionContext searchExpressionContext, String expression, ContextCallback callback) Resolves multipleUIComponent
s for the given expression.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.resolveClientId
(SearchExpressionContext searchExpressionContext, String expression) Resolves to a single clientId or passthrough expression for the given expression.resolveClientIds
(SearchExpressionContext searchExpressionContext, String expressions) Resolves to aList
with clientIds or passthrough expressions for the given expressions.void
resolveComponent
(SearchExpressionContext searchExpressionContext, String expression, ContextCallback callback) Resolves a singleUIComponent
s for the given expression.void
resolveComponents
(SearchExpressionContext searchExpressionContext, String expressions, ContextCallback callback) Resolves multipleUIComponent
s for the given expression(s).String[]
splitExpressions
(FacesContext context, String expressions) Splits an string, based onSearchExpressionHandler.getExpressionSeperatorChars(jakarta.faces.context.FacesContext)
with possible multiple expressions into an array.
-
Constructor Details
-
SearchExpressionHandlerWrapper
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.- Parameters:
wrapped
- The implementation being wrapped.- Since:
- 2.3
-
-
Method Details
-
getWrapped
Description copied from interface:FacesWrapper
A class that implements this interface uses this method to return an instance of the class being wrapped.
- Specified by:
getWrapped
in interfaceFacesWrapper<SearchExpressionHandler>
- Returns:
- the wrapped instance.
-
resolveClientId
Description copied from class:SearchExpressionHandler
Resolves to a single clientId or passthrough expression for the given expression.
- Specified by:
resolveClientId
in classSearchExpressionHandler
- Parameters:
searchExpressionContext
- theSearchExpressionContext
expression
- the search expression- Returns:
- The resolved clientId or passtrough expression. If the expression can not be resolved and if
SearchExpressionHint.IGNORE_NO_RESULT
was passed,null
will be returned.
-
resolveClientIds
public List<String> resolveClientIds(SearchExpressionContext searchExpressionContext, String expressions) Description copied from class:SearchExpressionHandler
Resolves to a
List
with clientIds or passthrough expressions for the given expressions. The expressions will be splitted bySearchExpressionHandler.splitExpressions(jakarta.faces.context.FacesContext, java.lang.String)
and resolved one by one.- Specified by:
resolveClientIds
in classSearchExpressionHandler
- Parameters:
searchExpressionContext
- theSearchExpressionContext
expressions
- the search expressions- Returns:
- The resolved clientIds and passtrough expressions.
-
resolveComponent
public void resolveComponent(SearchExpressionContext searchExpressionContext, String expression, ContextCallback callback) Description copied from class:SearchExpressionHandler
Resolves a single
UIComponent
s for the given expression. If the component is resolved, theContextCallback
will be invoked.- Specified by:
resolveComponent
in classSearchExpressionHandler
- Parameters:
searchExpressionContext
- theSearchExpressionContext
expression
- the search expressioncallback
- the callback for the resolved component
-
resolveComponents
public void resolveComponents(SearchExpressionContext searchExpressionContext, String expressions, ContextCallback callback) Description copied from class:SearchExpressionHandler
Resolves multiple
UIComponent
s for the given expression(s). The expressions will be splitted bySearchExpressionHandler.splitExpressions(jakarta.faces.context.FacesContext, java.lang.String)
and resolved one by one. For each resolved component, theContextCallback
will be invoked.- Specified by:
resolveComponents
in classSearchExpressionHandler
- Parameters:
searchExpressionContext
- theSearchExpressionContext
expressions
- the search expression(s)callback
- the callback for each resolved component
-
invokeOnComponent
public void invokeOnComponent(SearchExpressionContext searchExpressionContext, String expression, ContextCallback callback) Description copied from class:SearchExpressionHandler
Resolves multiple
UIComponent
s for the given expression. For each resolved component, theContextCallback
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.- Overrides:
invokeOnComponent
in classSearchExpressionHandler
- Parameters:
searchExpressionContext
- theSearchExpressionContext
expression
- the search expressioncallback
- the callback for the resolved component
-
invokeOnComponent
public void invokeOnComponent(SearchExpressionContext searchExpressionContext, UIComponent previous, String expression, ContextCallback callback) Description copied from class:SearchExpressionHandler
Resolves multiple
UIComponent
s for the given expression. For each resolved component, theContextCallback
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.- Specified by:
invokeOnComponent
in classSearchExpressionHandler
- Parameters:
searchExpressionContext
- theSearchExpressionContext
previous
- The previous resolved component, that will be the base for searchingexpression
- the search expressioncallback
- the callback for the resolved component
-
isValidExpression
public boolean isValidExpression(SearchExpressionContext searchExpressionContext, String expression) Description copied from class:SearchExpressionHandler
Checks if the given expression is a valid expression.
A expression is invalid if:- No
SearchKeywordResolver
matches the requested keyword - A keyword or id is placed after a leaf keyword (@none:@form)
- Specified by:
isValidExpression
in classSearchExpressionHandler
- Parameters:
searchExpressionContext
- theSearchExpressionContext
expression
- the expression- Returns:
- If the given expression is a valid expression
- No
-
isPassthroughExpression
public boolean isPassthroughExpression(SearchExpressionContext searchExpressionContext, String expression) Description copied from class: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.- Specified by:
isPassthroughExpression
in classSearchExpressionHandler
- Parameters:
searchExpressionContext
- theSearchExpressionContext
expression
- the expression- Returns:
- If the given expression is a passtrough expression
-
splitExpressions
Description copied from class:SearchExpressionHandler
Splits an string, based on
SearchExpressionHandler.getExpressionSeperatorChars(jakarta.faces.context.FacesContext)
with possible multiple expressions into an array.- Specified by:
splitExpressions
in classSearchExpressionHandler
- Parameters:
context
- theFacesContext
for the current requestexpressions
- The expressions as string- Returns:
- the expression(s) as array
-
getExpressionSeperatorChars
Description copied from class:SearchExpressionHandler
Return the characters used to separate expressions in a series of expressions. The default implementation returns
SearchExpressionHandler.EXPRESSION_SEPARATOR_CHARS
.- Overrides:
getExpressionSeperatorChars
in classSearchExpressionHandler
- Parameters:
context
- theFacesContext
for the current request- Returns:
- the separator chars
-