org.eclipse.actf.validation.rules
Interface IRule

All Superinterfaces:
ICriterion
All Known Implementing Classes:
AbstractRule, AndRule, EqRule, FocusRule, InstanceofRule, MaxRule, MinRule, NeqRule, OrRule, RangeRule, ReflexiveCriterion, ReflexiveRule, RegexpRule, ScriptRule

public interface IRule
extends ICriterion

an interface to be implemented to add rules to the validation engine.

Author:
Mike Squillace

Method Summary
 String getComponentCategory()
          return the unique component category identifier in effect at the time this rule is evaluated.
 String getId()
          get the unique id for this rule
 boolean getIgnoreIfNull()
          returns the actf:ignoreifnull attribute for this rule
 Iterator getIterator(Object collection)
          returns the iterator used for this rule should the rule involve any sort of collection or array.
 String getLongDescription()
          returns the long description received upon a violation of this rule
 String getMessage()
          returns the message resulting from violating this rule
 String getName()
          return the name of the rule.
 String getRepairHint()
          returns the repair hint for this rule
 int getSeverity()
          return the severity level for a violation of this rule.
 boolean isEnabled()
          returns the enable attribute for this rule
 void setComponentCategory(String categoryId)
          set the component category identifier for this rule.
 void setEnabled(boolean enable)
          set the enable attribute for this rule.
 void setId(String id)
          set the id for this rule.
 void setIgnoreIfNull(boolean ignoreIfNull)
          set the actf:ignoreifnull attribute for this rule.
 void setIteratorName(String clsName)
          set the class name of the iterator to be used for iterating through any sort of collection.
 void setLongDescription(String desc)
          set the long description or message to be received upon a violation of this rule.
 void setMessage(String msg)
          set the message to be received upon a violation of this rule.
 void setName(String name)
          set the name for this rule.
 void setRepairHint(String hint)
          set the repair hint for this rule.
 void setSeverity(int level)
          set the severity level for a violation of this rule.
 
Methods inherited from interface org.eclipse.actf.validation.rules.ICriterion
addPart, apply, getAttribute, getParent, getParts, getRuleSet, initialize, setAttribute, setParent, setParts, setRuleSet
 

Method Detail

getName

String getName()
return the name of the rule. This might also serve as a short description of the purpose of the rule or what it is testing.

Returns:
name of rule

setName

void setName(String name)
set the name for this rule. The name need not be unique but should be a short description of the rule or of what it is testing.

Parameters:
name -

getId

String getId()
get the unique id for this rule

Returns:
String

setId

void setId(String id)
set the id for this rule. The id for a rule should be unique within a given rulebase.

Parameters:
id -

isEnabled

boolean isEnabled()
returns the enable attribute for this rule

Returns:
whether this rule is enabled (true | false )

setEnabled

void setEnabled(boolean enable)
set the enable attribute for this rule. If enable is true then this rule is evaluated. If enable is false then this rule is skipped.

Parameters:
enable - - true | false

getMessage

String getMessage()
returns the message resulting from violating this rule

Returns:
message to be received when rule is violated

setMessage

void setMessage(String msg)
set the message to be received upon a violation of this rule. This message is typically short and can be supplemented by the long description.

Parameters:
msg - - message to be received upon a violation of this rule
See Also:
setLongDescription(String)

getLongDescription

String getLongDescription()
returns the long description received upon a violation of this rule

Returns:
long description or message received upon a violation of this rule

setLongDescription

void setLongDescription(String desc)
set the long description or message to be received upon a violation of this rule. The long description can supplement the shorter message for this rule.

Parameters:
desc - - long description to be received upon a violation of this rule
See Also:
setMessage(String)

getRepairHint

String getRepairHint()
returns the repair hint for this rule

Returns:
repair hint

setRepairHint

void setRepairHint(String hint)
set the repair hint for this rule. The repair hint provides information about how to fix violations of this rule.

Parameters:
hint -

getSeverity

int getSeverity()
return the severity level for a violation of this rule.

Returns:
severity level

setSeverity

void setSeverity(int level)
set the severity level for a violation of this rule. The level will typically be one of the levels specified in org.eclipse.actf.util.logging.Reporter.

Parameters:
level -
See Also:
IReporter

getComponentCategory

String getComponentCategory()
return the unique component category identifier in effect at the time this rule is evaluated. The category identifier is used in validation reports.

Returns:
category identifier of component

getIgnoreIfNull

boolean getIgnoreIfNull()
returns the actf:ignoreifnull attribute for this rule

Returns:
whether apply(Object) returns true or false when this rule is evaluated with a null object

getIterator

Iterator getIterator(Object collection)
returns the iterator used for this rule should the rule involve any sort of collection or array. Note that a ArrayIterator is provided for arrays and a DomNodeIterator is provided for iterating through the nodes of a W3C DOM level 2 NodeList.

Other iterators may be specified using the actf:iterator attribute.

Parameters:
collection - with which to initialize iterator
Returns:
iterator used for collections or null if no iterator is required

setComponentCategory

void setComponentCategory(String categoryId)
set the component category identifier for this rule. The parent rule, the first child of a first child of a element, will typically contain this value since all rules are evaluated for this component. This value is used when creating a report record and provides a unique identifier for this particular component.

Parameters:
categoryId -

setIgnoreIfNull

void setIgnoreIfNull(boolean ignoreIfNull)
set the actf:ignoreifnull attribute for this rule. If ignoreifnull is true then this rule is ignored if the target object to evaluate in the apply(Object) method is null. If ignoreifnull is false then apply(Object) will fail if the target object is null.

Parameters:
ignoreIfNull - - true | false

setIteratorName

void setIteratorName(String clsName)
set the class name of the iterator to be used for iterating through any sort of collection. This attribute is set using the RuleConstants.ITERATOR attribute.

Parameters:
clsName - - class name of iterator to be used
See Also:
RuleConstants.ITERATOR