org.eclipse.actf.validation.rules
Interface IRuleFactory

All Known Implementing Classes:
ReflectionDocumentRuleFactory

public interface IRuleFactory

A factory for rules. A factory instance, once obtained, can be used to find rules 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 atached to a IRuleSet.

Author:
Mike Squillace
See Also:
IRuleSet.setRuleFactory(IRuleFactory), IRuleMapping

Method Summary
 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.
 IRuleMapping getRuleMapping(Object rulesetToken)
          retreaves a rule mapping that maps a type of object to a set of rules.
 IRuleSet getRuleSet()
           
 IRule makeRuleInstance(Object obj)
          Makes an instance of the rule using the object.
 IRule makeRuleInstance(Object obj, IRule parent)
          Makes an instance of the rule 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)

makeRuleInstance

IRule makeRuleInstance(Object obj)
Makes an instance of the rule using the object.

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

makeRuleInstance

IRule makeRuleInstance(Object obj,
                       IRule parent)
Makes an instance of the rule using the object having the specified parent.

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

getRuleMapping

IRuleMapping getRuleMapping(Object rulesetToken)
retreaves a rule 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