Class RegExQueryFilter
- java.lang.Object
-
- org.apache.activemq.console.filter.AbstractQueryFilter
-
- org.apache.activemq.console.filter.RegExQueryFilter
-
- All Implemented Interfaces:
QueryFilter
- Direct Known Subclasses:
MBeansRegExQueryFilter
public abstract class RegExQueryFilter extends AbstractQueryFilter
-
-
Field Summary
Fields Modifier and Type Field Description static String
REGEX_PREFIX
-
Fields inherited from class org.apache.activemq.console.filter.AbstractQueryFilter
next
-
Fields inherited from interface org.apache.activemq.console.filter.QueryFilter
QUERY_DELIMETER
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RegExQueryFilter(QueryFilter next)
Creates a regular expression query that is able to match an object using key-value pattern regex filtering
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Pattern
compileQuery(String query)
Compiles the regex query to a pattern.protected List
filterCollectionUsingRegEx(Map regex, List data)
Filter the specified colleciton using the regex patterns extracted.protected boolean
isRegularExpression(String query)
Checks if a given string is a regular expression query.protected abstract boolean
matches(Object data, Map regex)
Determines how the object is to be matched to the regex map.List
query(List queries)
Separates the regular expressions queries from the usual queries.-
Methods inherited from class org.apache.activemq.console.filter.AbstractQueryFilter
query
-
-
-
-
Field Detail
-
REGEX_PREFIX
public static final String REGEX_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RegExQueryFilter
protected RegExQueryFilter(QueryFilter next)
Creates a regular expression query that is able to match an object using key-value pattern regex filtering- Parameters:
next
-
-
-
Method Detail
-
query
public List query(List queries) throws Exception
Separates the regular expressions queries from the usual queries. A query is a regex query, if it is key-value pair with the format= , and value is a pattern that satisfies the isRegularExpression method. - Parameters:
queries
- - list of queries- Returns:
- filtered objects that matches the regex query
- Throws:
Exception
-
isRegularExpression
protected boolean isRegularExpression(String query)
Checks if a given string is a regular expression query. Currently, a pattern is a regex query, if it starts with the RegExQueryFilter.REGEX_PREFIX.- Parameters:
query
-- Returns:
- boolean result of query check
-
compileQuery
protected Pattern compileQuery(String query)
Compiles the regex query to a pattern.- Parameters:
query
- - query string to compile- Returns:
- regex pattern
-
filterCollectionUsingRegEx
protected List filterCollectionUsingRegEx(Map regex, List data) throws Exception
Filter the specified colleciton using the regex patterns extracted.- Parameters:
regex
- - regex mapdata
- - list of objects to filter- Returns:
- filtered list of objects that matches the regex map
- Throws:
Exception
-
-