org.mod4j.runtime.domain
Class AbstractDomainObject

java.lang.Object
  extended by org.mod4j.runtime.domain.AbstractDomainObject

public abstract class AbstractDomainObject
extends java.lang.Object

The first reason to introduce this class is to provide a generic validate() method for all domain objects.

Author:
Eric Jan Malotaux

Field Summary
protected  BusinessRuleValidationTemplate validationTemplate
           
protected  java.util.List<org.springframework.validation.Validator> validators
           
 
Constructor Summary
AbstractDomainObject()
           
 
Method Summary
 void addValidator(org.springframework.validation.Validator validator)
          Add the given validator to the collection of validators that will be executed on this object when the validate() method is called.
protected  void validate()
          Validate this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validators

protected java.util.List<org.springframework.validation.Validator> validators

validationTemplate

protected final BusinessRuleValidationTemplate validationTemplate
Constructor Detail

AbstractDomainObject

public AbstractDomainObject()
Method Detail

addValidator

public void addValidator(org.springframework.validation.Validator validator)
Add the given validator to the collection of validators that will be executed on this object when the validate() method is called. The validators will be invoked in the order they were added.

Parameters:
validator - - the validator being added.

validate

protected void validate()
                 throws BusinessRuleException
Validate this object. Validation is performed by calling every Validator added by the addValidator(Validator) method, in the order they were added.

Throws:
BusinessRuleException - - thrown when one or more errors are found. The exception thrown has as its cause a BindException containing information on all errors found.


Copyright © 2009. All Rights Reserved.