Class MetaFilter
- java.lang.Object
-
- org.jbehave.core.embedder.MetaFilter
-
public class MetaFilter extends Object
Allows filtering on meta info.
A filter is uniquely identified by its String representation which is parsed and matched by the
MetaFilter.MetaMatcherto determine if theMetais allowed or not.The
MetaFilter.DefaultMetaMatcherinterprets 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.excluded(new Meta(asList("map someAPI")));The use of the
MetaFilter.GroovyMetaMatcheris 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'");Custom
MetaFilter.MetaMatcherinstances can also be provided as a map, indexed by the prefix used in the filter content:Map<String, MetaMatcher> customMatchers = new HashMap<>(); customMatchers.put("ruby:", new RubyMetaMatcher()); MetaFilter filter = new MetaFilter("ruby: # some ruby script", customMatchers);Custom MetaMatcher instances, when they are matched by the prefix of the filter content, will take precedence over the Groovy or default matchers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classMetaFilter.DefaultMetaMatcherclassMetaFilter.GroovyMetaMatcherstatic interfaceMetaFilter.MetaMatcher
-
Field Summary
Fields Modifier and Type Field Description static MetaFilterEMPTY
-
Constructor Summary
Constructors Constructor Description MetaFilter()MetaFilter(String filterAsString)MetaFilter(String filterAsString, Map<String,MetaFilter.MetaMatcher> metaMatchers)MetaFilter(String filterAsString, EmbedderMonitor monitor)MetaFilter(String filterAsString, EmbedderMonitor monitor, Map<String,MetaFilter.MetaMatcher> metaMatchers)
-
Method Summary
Modifier and Type Method Description StringasString()protected MetaFilter.MetaMatchercreateMetaMatcher(String filterAsString, Map<String,MetaFilter.MetaMatcher> metaMatchers)Creates a MetaMatcher based on the filter content.booleanexcluded(Meta meta)booleanisEmpty()MetaFilter.MetaMatchermetaMatcher()StringtoString()
-
-
-
Field Detail
-
EMPTY
public static final MetaFilter EMPTY
-
-
Constructor Detail
-
MetaFilter
public MetaFilter()
-
MetaFilter
public MetaFilter(String filterAsString)
-
MetaFilter
public MetaFilter(String filterAsString, EmbedderMonitor monitor)
-
MetaFilter
public MetaFilter(String filterAsString, Map<String,MetaFilter.MetaMatcher> metaMatchers)
-
MetaFilter
public MetaFilter(String filterAsString, EmbedderMonitor monitor, Map<String,MetaFilter.MetaMatcher> metaMatchers)
-
-
Method Detail
-
createMetaMatcher
protected MetaFilter.MetaMatcher createMetaMatcher(String filterAsString, Map<String,MetaFilter.MetaMatcher> metaMatchers)
Creates a MetaMatcher based on the filter content.- Parameters:
filterAsString- the String representation of the filtermetaMatchers- the Map of custom MetaMatchers- Returns:
- A MetaMatcher used to match the filter content
-
excluded
public boolean excluded(Meta meta)
-
metaMatcher
public MetaFilter.MetaMatcher metaMatcher()
-
asString
public String asString()
-
isEmpty
public boolean isEmpty()
-
-