org.apache.activemq.console.filter
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
Constructor Summary |
protected |
RegExQueryFilter(QueryFilter next)
Creates a regular expression query that is able to match an object using
key-value pattern regex filtering |
Method Summary |
protected java.util.regex.Pattern |
compileQuery(java.lang.String query)
Compiles the regex query to a pattern. |
protected java.util.List |
filterCollectionUsingRegEx(java.util.Map regex,
java.util.List data)
Filter the specified colleciton using the regex patterns extracted. |
protected boolean |
isRegularExpression(java.lang.String query)
Checks if a given string is a regular expression query. |
protected abstract boolean |
matches(java.lang.Object data,
java.util.Map regex)
Determines how the object is to be matched to the regex map. |
java.util.List |
query(java.util.List queries)
Separates the regular expressions queries from the usual queries. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REGEX_PREFIX
public static final java.lang.String REGEX_PREFIX
- See Also:
- Constant Field Values
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
-
query
public java.util.List query(java.util.List queries)
throws java.lang.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:
java.lang.Exception
isRegularExpression
protected boolean isRegularExpression(java.lang.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 java.util.regex.Pattern compileQuery(java.lang.String query)
- Compiles the regex query to a pattern.
- Parameters:
query
- - query string to compile
- Returns:
- regex pattern
filterCollectionUsingRegEx
protected java.util.List filterCollectionUsingRegEx(java.util.Map regex,
java.util.List data)
throws java.lang.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:
java.lang.Exception
matches
protected abstract boolean matches(java.lang.Object data,
java.util.Map regex)
throws java.lang.Exception
- Determines how the object is to be matched to the regex map.
- Parameters:
data
- - object to matchregex
- - regex map
- Returns:
- true, if the object matches the regex map, false otherwise
- Throws:
java.lang.Exception
Copyright © 2005-2012. All Rights Reserved.