001    package hirondelle.web4j.model;
002    
003    /**
004     Thrown when a Model Object (MO) cannot be constructed because of invalid 
005     constructor arguments.
006    
007     <P>Arguments to a MO constructor have two sources: the end user and the 
008     the database. In both cases, errors in the values of these arguments 
009     are outside the immediate control of the application. Hence, MO constructors 
010     should throw a checked exception - (<tt>ModelCtorException</tt>).
011    
012     <P>Using a checked exception has the advantage that
013     it cannot be ignored by the caller.
014    
015     Example use case:<br>
016    <PRE>
017      //a Model Object constructor 
018      Blah(String aText, int aID) throws ModelCtorException {
019        //check validity of all params.
020        //if one or more params is invalid, throw a ModelCtorException.
021        //for each invalid param, add a corresponding error message to 
022        //ModelCtorException. 
023      }
024    
025      //call the Model Object constructor 
026      try {
027        Blah blah = new Blah(text, id);
028      }
029      catch(ModelCtorException ex){
030        //place the exception in scope, for subsequent 
031        //display to the user in a JSP
032      }
033    </PRE>
034    
035     <P>In the case of an error, the problem arises of how to redisplay the original, 
036     erroneous user input. The {@link hirondelle.web4j.ui.tag.Populate} tag 
037     accomplishes this in an elegant manner, simply by recycling the original 
038     request parameters.
039    */
040    public final class ModelCtorException extends AppException {
041      //empty
042    }
043