public class MetaFilter
extends java.lang.Object
Allows filtering on meta info.
A filter is uniquely identified by its String representation which is parsed
and matched by the MetaFilter.MetaMatcher
to determine if the Meta
is
allowed or not.
The MetaFilter.DefaultMetaMatcher
interprets the filter as a sequence of any
name-value properties (separated by a space), prefixed by "+" for inclusion
and "-" for exclusion. E.g.:
MetaFilter filter = new MetaFilter("+author Mauro -theme smoke testing +map *API -skip"); filter.allow(new Meta(asList("map someAPI")));
The use of the MetaFilter.GroovyMetaMatcher
is triggered by the prefix "groovy:" and
allows the filter to be interpreted as a Groovy expression.
MetaFilter filter = new MetaFilter("groovy: (a == '11' | a == '22') && b == '33'");
Modifier and Type | Class and Description |
---|---|
class |
MetaFilter.DefaultMetaMatcher |
class |
MetaFilter.GroovyMetaMatcher |
static interface |
MetaFilter.MetaMatcher |
Modifier and Type | Field and Description |
---|---|
static MetaFilter |
EMPTY |
Constructor and Description |
---|
MetaFilter() |
MetaFilter(java.lang.String filterAsString) |
MetaFilter(java.lang.String filterAsString,
EmbedderMonitor monitor) |
Modifier and Type | Method and Description |
---|---|
boolean |
allow(Meta meta) |
java.lang.String |
asString() |
protected MetaFilter.MetaMatcher |
createMetaMatcher(java.lang.String filterAsString)
Creates a MetaMatcher based on the filter content.
|
MetaFilter.MetaMatcher |
metaMatcher() |
java.lang.String |
toString() |
public static final MetaFilter EMPTY
public MetaFilter()
public MetaFilter(java.lang.String filterAsString)
public MetaFilter(java.lang.String filterAsString, EmbedderMonitor monitor)
protected MetaFilter.MetaMatcher createMetaMatcher(java.lang.String filterAsString)
filterAsString
- the String representation of the filterpublic boolean allow(Meta meta)
public MetaFilter.MetaMatcher metaMatcher()
public java.lang.String asString()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2003-2014. All Rights Reserved.