org.sapia.validator
Class CompositeRule

java.lang.Object
  extended by org.sapia.validator.Rule
      extended by org.sapia.validator.CompositeRule
All Implemented Interfaces:
org.sapia.util.xml.confix.ObjectCreationCallback, org.sapia.util.xml.confix.ObjectHandlerIF, Validatable
Direct Known Subclasses:
ForEach

public class CompositeRule
extends Rule
implements org.sapia.util.xml.confix.ObjectHandlerIF

An instance of this class is intended to hold other validation rules.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Field Summary
protected  boolean _stop
           
 
Constructor Summary
CompositeRule()
          Constructor for CompositeRule.
 
Method Summary
 void addValidatable(Validatable v)
          Adds a Validatable to this instance.
 RuleSet createRuleSet()
          Creates a rule set and returns it.
 void handleObject(String name, Object validatable)
           
 void setStop(boolean stop)
          Sets the "stop" flag to true or false.
 void validate(ValidationContext ctx)
          Validates this instance.
 
Methods inherited from class org.sapia.validator.Rule
createMessage, getErrorMessageFor, getErrorMessages, getId, initName, localName, onCreate, prefix, qualifiedName, setErrorMessages, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_stop

protected boolean _stop
Constructor Detail

CompositeRule

public CompositeRule()
Constructor for CompositeRule.

Method Detail

addValidatable

public void addValidatable(Validatable v)
Adds a Validatable to this instance.

Parameters:
a - Validatable.

setStop

public void setStop(boolean stop)
Sets the "stop" flag to true or false. This flag meaning is as follows: when an instance of this class processes its nested rules, it will continue with the next rule even if the previous one generated an error, provided this flag is set to false.

This feature allows for subsequent rules to be processed even if validation errors have previously been created; thus, in such a case, the ValidationContext could potentially contain more than one instance of ValidationErr.

Parameters:
stop - this instance's "stop" flag.
See Also:
ValidationContext, ValidationErr

createRuleSet

public RuleSet createRuleSet()
Creates a rule set and returns it.

Returns:
a RuleSet.

handleObject

public void handleObject(String name,
                         Object validatable)
                  throws org.sapia.util.xml.confix.ConfigurationException
Specified by:
handleObject in interface org.sapia.util.xml.confix.ObjectHandlerIF
Throws:
org.sapia.util.xml.confix.ConfigurationException
See Also:
ObjectHandlerIF.handleObject(String, Object)

validate

public void validate(ValidationContext ctx)
Description copied from interface: Validatable
Validates this instance.

Specified by:
validate in interface Validatable
Specified by:
validate in class Rule
See Also:
Rule.validate(ValidationContext)


Copyright © 2002 Sapia Open Community, Inc. All Rights Reserved.