Class SearchExpressionHandlerWrapper
- java.lang.Object
-
- jakarta.faces.component.search.SearchExpressionHandler
-
- jakarta.faces.component.search.SearchExpressionHandlerWrapper
-
- All Implemented Interfaces:
FacesWrapper<SearchExpressionHandler>
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 existingSearchExpressionHandler
instance. The default implementation of all methods is to call through to the wrappedSearchExpressionHandler
instance. Usage: extend this class and push the implementation being wrapped to the constructor and usegetWrapped()
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
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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, 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.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 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 Detail
-
SearchExpressionHandlerWrapper
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.- Parameters:
wrapped
- The implementation being wrapped.- Since:
- 2.3
-
-
Method Detail
-
getWrapped
public SearchExpressionHandler 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
public String resolveClientId(SearchExpressionContext searchExpressionContext, String expression)
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
public String[] splitExpressions(FacesContext context, String expressions)
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
public char[] getExpressionSeperatorChars(FacesContext context)
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
-
-