org.openbp.common.string.shellmatcher
Class MultiMatcher

java.lang.Object
  extended by org.openbp.common.string.shellmatcher.MultiMatcher
All Implemented Interfaces:
java.io.Serializable

public class MultiMatcher
extends java.lang.Object
implements java.io.Serializable

This matcher class performs matches of objects against arbitrary search criteria. Each criteria (class MultiPattern) consists of an attribute name and a pattern. The pairs might be connected using an 'and' or an 'or' operation. The attribute name of a pattern specifies a field of the object to match.
The matcher will look for an appropriate getter method (get\iAttributeName\i (), is\iAttributeName\i for boolean values) to perform the match. The attribute value can be one of the following types:

Example:

Author:
Heiko Erhardt
See Also:
Serialized Form

Constructor Summary
MultiMatcher()
          Default constructor
 
Method Summary
 void addPattern(MultiPattern pattern)
          Adds a pattern.
 void addPattern(java.lang.String attributeName, java.lang.Object attributeValue)
          Adds a pattern.
 boolean isOrRelation()
          Gets the relation type.
 boolean match(java.lang.Object o)
          Determines if an object matches the criteria.
 void setOrRelation(boolean orRelation)
          Sets the relation type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiMatcher

public MultiMatcher()
Default constructor

Method Detail

addPattern

public void addPattern(java.lang.String attributeName,
                       java.lang.Object attributeValue)
Adds a pattern.

Parameters:
attributeName - Name of the attribute to match
attributeValue - Value of the attribute (see class comment)

addPattern

public void addPattern(MultiPattern pattern)
Adds a pattern.

Parameters:
pattern - Pattern to add

isOrRelation

public boolean isOrRelation()
Gets the relation type.

Returns:
true: OR relation
false: AND relation

setOrRelation

public void setOrRelation(boolean orRelation)
Sets the relation type.

Parameters:
orRelation - true: OR relation
false: AND relation

match

public boolean match(java.lang.Object o)
Determines if an object matches the criteria.

Parameters:
o - Object to match against the pattern
Returns:
true The object matches the pattern.
false The object does not match.


Copyright © 2011. All Rights Reserved.