001    package hirondelle.web4j.model;
002    
003    /**
004     Validate a field in a Model Object.
005     
006     <P>Model Objects are <em>not</em> required to use this interface when validating data, but it is  
007     often convenient to do so. In combination with {@link Check}, this interface is meant to reduce 
008     code repetition related to validation. 
009     
010     <P>This interface is appropriate only for checks on a single field. 
011     
012     <P>Please see {@link Check} for more information, and for some useful implementations.
013    */
014    public interface Validator {
015    
016      /**
017       Return <tt>true</tt> only if <tt>aObject</tt> passes this validation.
018       
019       <P><tt>aObject</tt> is a field in some Model Object, being validated in a constructor. If the 
020       field is a primitive value (such as <tt>int</tt>), then it must be converted by the caller into 
021       a corresponding wrapper object (such as {@link Integer}).
022       
023       @param aObject may be <tt>null</tt>. 
024      */
025      boolean isValid(Object aObject);
026    
027    }