View Javadoc

1   /*
2   Copyright (c) 2008 Health Market Science, Inc.
3   
4   This library is free software; you can redistribute it and/or
5   modify it under the terms of the GNU Lesser General Public
6   License as published by the Free Software Foundation; either
7   version 2.1 of the License.
8   
9   This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  Lesser General Public License for more details.
13  
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
17  USA
18  
19  You can contact Health Market Science at info@healthmarketscience.com
20  or at the following address:
21  
22  Health Market Science
23  2700 Horizon Drive
24  Suite 200
25  King of Prussia, PA 19406
26  */
27  
28  package com.healthmarketscience.sqlbuilder;
29  
30  /**
31   * Interface for SqlObjects wishing to provide verifiablity.  In general, all
32   * checking in SqlObject implementations is deferred until an object is fully
33   * constructed.  As a post process, a user may choose to validate the sql
34   * construct after it is fully constructed by calling the validate method.
35   *
36   * @author James Ahlborn
37   */
38  public interface Verifiable<ThisType extends Verifiable<ThisType>> {
39  
40    /**
41     * Runs validation on this verifiable object.
42     * 
43     * @return a handle to this instance
44     */
45    public ThisType validate() throws ValidationException;
46    
47    /**
48     * Runs validation on this verifiable object using a previously collected
49     * ValidationContext.
50     * <p>
51     * In general, this method will only be called internally, not by users.
52     *
53     * @param vContext handle to the current, filled-in validation context
54     */
55    public void validate(ValidationContext vContext)
56      throws ValidationException;
57    
58  }