org.virtualmock.rule
Class RuleManager

java.lang.Object
  extended byorg.virtualmock.rule.RuleManager

public class RuleManager
extends java.lang.Object

Class which handles evaluation and reporting of rules and rule violations. This method checkAllRulesInCurrentPhase performs checks for all Rules that are applicable to the current phase. New rules can be added at runtime. If a new rule is added which has the same key as an existing rule, the old rule will be replaced.

Version:
$Revision: 1.26 $
Author:
Chad Woolley

Constructor Summary
RuleManager(java.util.List rules, ResourceManager resourceManager)
          Creates a new RuleManager object.
 
Method Summary
 void addRule(Rule rule)
          Adds a rule to be checked.
 void checkAllRulesInCurrentPhase()
          Checks all rules in current phase.
 Rule getRule(java.lang.String key)
          Returns the Rule for the specified key, or null if no Rule matches the key.
 java.util.List getRules()
          Returns all of the rules that are currently defined.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleManager

public RuleManager(java.util.List rules,
                   ResourceManager resourceManager)
Creates a new RuleManager object.

Parameters:
rules - the initial list of Rules which will be managed
resourceManager - the ResourceManager to be used when creating messages
Method Detail

getRule

public Rule getRule(java.lang.String key)
Returns the Rule for the specified key, or null if no Rule matches the key.

Parameters:
key - DOCUMENT ME! (Constructor Parameter)
Returns:
the Rule for the specified key, or null if no Rule matches the key.

getRules

public java.util.List getRules()
Returns all of the rules that are currently defined.

Returns:
all of the rules that are currently defined

addRule

public void addRule(Rule rule)
Adds a rule to be checked.

Parameters:
rule - the Rule that is being added

checkAllRulesInCurrentPhase

public void checkAllRulesInCurrentPhase()
Checks all rules in current phase.

Throws:
java.lang.Error - if the rule was violated


Copyright © 2003-2005 Virtual Mock. All Rights Reserved.