org.eclipse.actf.validation.rules
Interface ICriterionFactory

All Known Implementing Classes:
ReflectionDocumentCriterionFactory

public interface ICriterionFactory

A factory for criterions. A factory instance, once obtained, can be used to find criterions for a given type of object using a IRuleMapping. Implementations should be specified using the <actf:ruleFactory> attribute in documents or programatically. In either case, rule factories should always be attached to a IRuleSet.

Author:
Mike Squillace
See Also:
IRuleSet.setCriterionFactory(ICriterionFactory), ICriterionFactory

Method Summary
 ICriterionMapping getCriterionMapping(Object rulesetToken)
          retrieves a criterion mapping that maps a type of object to a set of rules.
 IRuleBase getRuleBase()
           
 IRule getRuleInstance(String name)
          gets an instance of the validation rule for the given name.
 IRule getRuleInstance(String name, IRule parent)
          creates and initializes a validation rule for the given name.
 IRuleSet getRuleSet()
           
 ICriterion makeCriterionInstance(Object obj)
          Makes an instance of the criterion using the object.
 ICriterion makeCriterionInstance(Object obj, ICriterion parent)
          Makes an instance of the criterion using the object having the specified parent.
 void registerRuleClassName(String name, String ruleClassName)
          registers a validation rule class for the given type
 void setRuleBase(IRuleBase ruleBase)
          set the rulebase for this factory
 void setRuleSet(IRuleSet ruleSet)
          set the ruleset for this factory
 

Method Detail

setRuleBase

void setRuleBase(IRuleBase ruleBase)
set the rulebase for this factory


getRuleBase

IRuleBase getRuleBase()
Returns:
rulebase

setRuleSet

void setRuleSet(IRuleSet ruleSet)
set the ruleset for this factory


getRuleSet

IRuleSet getRuleSet()
Returns:
ruleset

registerRuleClassName

void registerRuleClassName(String name,
                           String ruleClassName)
registers a validation rule class for the given type

Parameters:
name - - name under which the rule is being registered
ruleClassName - - the class name of the rule implementation

getRuleInstance

IRule getRuleInstance(String name)
gets an instance of the validation rule for the given name. The rule must have been previously registered via the registerRuleClassName method or must be one of the standard ACTF validation rules.

Parameters:
name - - name of the rule
Returns:
the registered rule for the given name or null if there was no rule registered under that name
See Also:
registerRuleClassName(String, String)

getRuleInstance

IRule getRuleInstance(String name,
                      IRule parent)
creates and initializes a validation rule for the given name. The rule must have been previously registered via the registerRuleClassName method or must be one of the standard ACTF validation rules.

Parameters:
name - - name of the rule
parent - - parent rule instance
Returns:
the registered rule for the given name or null if there was no rule registered under that name
See Also:
registerRuleClassName(String, String)

makeCriterionInstance

ICriterion makeCriterionInstance(Object obj)
Makes an instance of the criterion using the object.

Parameters:
obj - - Object from which the criterion is derived
Returns:
the criterion based on the input object

makeCriterionInstance

ICriterion makeCriterionInstance(Object obj,
                                 ICriterion parent)
Makes an instance of the criterion using the object having the specified parent.

Parameters:
obj - - Object from which the criterion is derived
parent - - parent criterion instance
Returns:
the criterion based on the input object

getCriterionMapping

ICriterionMapping getCriterionMapping(Object rulesetToken)
retrieves a criterion mapping that maps a type of object to a set of rules. The mapping is created lazily based on the token representing the ruleset with which this factory is associated.

Parameters:
rulesetToken - - ruleset (or token of ruleset) associated with this factory
Returns:
rule mapping