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
SearchExpressionHandlerthat can be subclassed by developers wishing to provide specialized behavior to an existingSearchExpressionHandlerinstance. The default implementation of all methods is to call through to the wrappedSearchExpressionHandlerinstance. 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.SearchExpressionHandlergetWrapped()A class that implements this interface uses this method to return an instance of the class being wrapped.voidinvokeOnComponent(SearchExpressionContext searchExpressionContext, UIComponent previous, String expression, ContextCallback callback)Resolves multipleUIComponents for the given expression.voidinvokeOnComponent(SearchExpressionContext searchExpressionContext, String expression, ContextCallback callback)Resolves multipleUIComponents for the given expression.booleanisPassthroughExpression(SearchExpressionContext searchExpressionContext, String expression)Checks if the given expression is a "passtrough expression".booleanisValidExpression(SearchExpressionContext searchExpressionContext, String expression)Checks if the given expression is a valid expression.StringresolveClientId(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 aListwith clientIds or passthrough expressions for the given expressions.voidresolveComponent(SearchExpressionContext searchExpressionContext, String expression, ContextCallback callback)Resolves a singleUIComponents for the given expression.voidresolveComponents(SearchExpressionContext searchExpressionContext, String expressions, ContextCallback callback)Resolves multipleUIComponents 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:FacesWrapperA class that implements this interface uses this method to return an instance of the class being wrapped.
- Specified by:
getWrappedin interfaceFacesWrapper<SearchExpressionHandler>- Returns:
- the wrapped instance.
-
resolveClientId
public String resolveClientId(SearchExpressionContext searchExpressionContext, String expression)
Description copied from class:SearchExpressionHandlerResolves to a single clientId or passthrough expression for the given expression.
- Specified by:
resolveClientIdin classSearchExpressionHandler- Parameters:
searchExpressionContext- theSearchExpressionContextexpression- the search expression- Returns:
- The resolved clientId or passtrough expression. If the expression can not be resolved and if
SearchExpressionHint.IGNORE_NO_RESULTwas passed,nullwill be returned.
-
resolveClientIds
public List<String> resolveClientIds(SearchExpressionContext searchExpressionContext, String expressions)
Description copied from class:SearchExpressionHandlerResolves to a
Listwith 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:
resolveClientIdsin classSearchExpressionHandler- Parameters:
searchExpressionContext- theSearchExpressionContextexpressions- the search expressions- Returns:
- The resolved clientIds and passtrough expressions.
-
resolveComponent
public void resolveComponent(SearchExpressionContext searchExpressionContext, String expression, ContextCallback callback)
Description copied from class:SearchExpressionHandlerResolves a single
UIComponents for the given expression. If the component is resolved, theContextCallbackwill be invoked.- Specified by:
resolveComponentin classSearchExpressionHandler- Parameters:
searchExpressionContext- theSearchExpressionContextexpression- the search expressioncallback- the callback for the resolved component
-
resolveComponents
public void resolveComponents(SearchExpressionContext searchExpressionContext, String expressions, ContextCallback callback)
Description copied from class:SearchExpressionHandlerResolves multiple
UIComponents 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, theContextCallbackwill be invoked.- Specified by:
resolveComponentsin classSearchExpressionHandler- Parameters:
searchExpressionContext- theSearchExpressionContextexpressions- 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:SearchExpressionHandlerResolves multiple
UIComponents for the given expression. For each resolved component, theContextCallbackwill 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:
invokeOnComponentin classSearchExpressionHandler- Parameters:
searchExpressionContext- theSearchExpressionContextexpression- 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:SearchExpressionHandlerResolves multiple
UIComponents for the given expression. For each resolved component, theContextCallbackwill 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:
invokeOnComponentin classSearchExpressionHandler- Parameters:
searchExpressionContext- theSearchExpressionContextprevious- 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:SearchExpressionHandlerChecks if the given expression is a valid expression.
A expression is invalid if:- No
SearchKeywordResolvermatches the requested keyword - A keyword or id is placed after a leaf keyword (@none:@form)
- Specified by:
isValidExpressionin classSearchExpressionHandler- Parameters:
searchExpressionContext- theSearchExpressionContextexpression- the expression- Returns:
- If the given expression is a valid expression
- No
-
isPassthroughExpression
public boolean isPassthroughExpression(SearchExpressionContext searchExpressionContext, String expression)
Description copied from class:SearchExpressionHandlerChecks if the given expression is a "passtrough expression". A passthrough expression must only be a keyword. This keyword will not be resolved by the
SearchKeywordResolverand will be returned untouched. The client is responsible to resolve it later.- Specified by:
isPassthroughExpressionin classSearchExpressionHandler- Parameters:
searchExpressionContext- theSearchExpressionContextexpression- the expression- Returns:
- If the given expression is a passtrough expression
-
splitExpressions
public String[] splitExpressions(FacesContext context, String expressions)
Description copied from class:SearchExpressionHandlerSplits an string, based on
SearchExpressionHandler.getExpressionSeperatorChars(jakarta.faces.context.FacesContext)with possible multiple expressions into an array.- Specified by:
splitExpressionsin classSearchExpressionHandler- Parameters:
context- theFacesContextfor the current requestexpressions- The expressions as string- Returns:
- the expression(s) as array
-
getExpressionSeperatorChars
public char[] getExpressionSeperatorChars(FacesContext context)
Description copied from class:SearchExpressionHandlerReturn the characters used to separate expressions in a series of expressions. The default implementation returns
SearchExpressionHandler.EXPRESSION_SEPARATOR_CHARS.- Overrides:
getExpressionSeperatorCharsin classSearchExpressionHandler- Parameters:
context- theFacesContextfor the current request- Returns:
- the separator chars
-
-