org.jbehave.core.embedder
Class MetaFilter

java.lang.Object
  extended by 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.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'");
 


Nested Class Summary
 class MetaFilter.DefaultMetaMatcher
           
 class MetaFilter.GroovyMetaMatcher
           
static interface MetaFilter.MetaMatcher
           
 
Field Summary
static MetaFilter EMPTY
           
 
Constructor Summary
MetaFilter()
           
MetaFilter(String filterAsString)
           
MetaFilter(String filterAsString, EmbedderMonitor monitor)
           
 
Method Summary
 boolean allow(Meta meta)
           
 String asString()
           
protected  MetaFilter.MetaMatcher createMetaMatcher(String filterAsString)
          Creates a MetaMatcher based on the filter content.
 MetaFilter.MetaMatcher metaMatcher()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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)
Method Detail

createMetaMatcher

protected MetaFilter.MetaMatcher createMetaMatcher(String filterAsString)
Creates a MetaMatcher based on the filter content.

Parameters:
filterAsString - the String representation of the filter
Returns:
A MetaMatcher

allow

public boolean allow(Meta meta)

metaMatcher

public MetaFilter.MetaMatcher metaMatcher()

asString

public String asString()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2012. All Rights Reserved.