com.openharbor.beck.configure
Class DefaultPredicate

java.lang.Object
  extended bycom.openharbor.beck.configure.DefaultPredicate
All Implemented Interfaces:
Predicate

public class DefaultPredicate
extends java.lang.Object
implements Predicate

A Predicate that matches selector values to conditions of its configuration. So, the configuration conditions are interpreted as a crude Boolean expression language.


Field Summary
static XMLName[] BOOLEAN_PROPERTIES
           
static XMLName[] CLASS_PROPERTIES
           
protected  java.util.Map conditions
           
protected  org.apache.commons.logging.Log log
           
static XMLName[] QNAME_PROPERTIES
           
 
Constructor Summary
DefaultPredicate()
           
 
Method Summary
 void configure(Unmarshaller parent, XMLThing source)
          Set configuration parameters.
 boolean evaluate(Configuration.Selector selector)
          Determine whether this predicate is true for the given selector.
protected  boolean match(Configuration.MarshalSelector selector)
           
protected  boolean match(Configuration.UnmarshalSelector selector)
           
protected  boolean matchAttribute(java.lang.Object expectedKey, boolean isAttribute, XMLName actual)
           
protected  boolean matchClass(java.lang.Object expectedKey, java.lang.Class actual)
           
protected  boolean matchClassIsArray(java.lang.Class actual)
           
protected  boolean matchElement(java.lang.Object expectedKey, boolean isAttribute, XMLName actual)
           
protected  boolean matchName(java.lang.Object expected, java.lang.Object actual)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log

BOOLEAN_PROPERTIES

public static final XMLName[] BOOLEAN_PROPERTIES

QNAME_PROPERTIES

public static final XMLName[] QNAME_PROPERTIES

CLASS_PROPERTIES

public static final XMLName[] CLASS_PROPERTIES

conditions

protected java.util.Map conditions
Constructor Detail

DefaultPredicate

public DefaultPredicate()
Method Detail

configure

public void configure(Unmarshaller parent,
                      XMLThing source)
Description copied from interface: Predicate
Set configuration parameters. This method need not be thread-safe.

Specified by:
configure in interface Predicate
Parameters:
parent - a handle on the When that contains this Predicate.
source - configuration parameters (as XML conditions)

toString

public java.lang.String toString()

evaluate

public boolean evaluate(Configuration.Selector selector)
Description copied from interface: Predicate
Determine whether this predicate is true for the given selector. This method must be thread-safe; that is, when called concurrently by multiple threads, the value returned to each thread must be independent of the threads' order of execution. This is ordinarily achieved by not modifying any objects.

Specified by:
evaluate in interface Predicate

match

protected boolean match(Configuration.MarshalSelector selector)

match

protected boolean match(Configuration.UnmarshalSelector selector)

matchName

protected boolean matchName(java.lang.Object expected,
                            java.lang.Object actual)

matchAttribute

protected boolean matchAttribute(java.lang.Object expectedKey,
                                 boolean isAttribute,
                                 XMLName actual)

matchElement

protected boolean matchElement(java.lang.Object expectedKey,
                               boolean isAttribute,
                               XMLName actual)

matchClass

protected boolean matchClass(java.lang.Object expectedKey,
                             java.lang.Class actual)

matchClassIsArray

protected boolean matchClassIsArray(java.lang.Class actual)