Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/clra/util/ValidationException.java


1   /*
2    * Copyright (c) Carnegie Lake Rowing Association 2002. All rights reserved.
3    * Distributed under the GPL license. See doc/COPYING.
4    * $RCSfile: ValidationException.java,v $
5    * $Date: 2003/02/26 03:38:45 $
6    * $Revision: 1.5 $
7    */
8   
9   package com.clra.util;
10  
11  /**
12   * Indicates data has failed validation rules. The accessor <tt>getType()</tt>
13   * indicates what type of data has failed validation.
14   *
15   * @version $Id: ValidationException.java,v 1.5 2003/02/26 03:38:45 rphall Exp $
16   * @author <a href="mailto:rphall@pluto.njcc.com">Rick Hall</a>
17   */
18  public class ValidationException extends Exception {
19  
20    public final static int UNKNOWN = -1;
21    public final static int MEMBER_ID = 0;
22    public final static int MEMBER_ACCOUNT_NAME = 1;
23    public final static int MEMBER_ACCOUNT_PASSWORD = 2;
24    public final static int MEMBER_ACCOUNT_TYPE = 3;
25    public final static int MEMBER_NAME = 4;
26    public final static int MEMBER_NAME_FIRST = 5;
27    public final static int MEMBER_NAME_LAST = 6;
28    public final static int MEMBER_EMAIL = 7;
29    public final static int MEMBER_TELEPHONE_NUMBER = 8;
30    public final static int MEMBER_TELEPHONE_COLLECTION = 9;
31    public final static int MEMBER_ADDRESS = 10;
32    public final static int MEMBER_ADDRESS_STREET1 = 11;
33    public final static int MEMBER_ADDRESS_STREET2 = 12;
34    public final static int MEMBER_ADDRESS_CITY = 13;
35    public final static int MEMBER_ADDRESS_STATE = 14;
36    public final static int MEMBER_ADDRESS_ZIP = 15;
37    public final static int MEMBER_ACCOUNT_YEAR = 16;
38    public final static int MEMBER_BIRTH = 17;
39  
40    private final static int LOWER = UNKNOWN;
41    private final static int UPPER = MEMBER_BIRTH;
42  
43    private final int type;
44  
45    public ValidationException( String devMsg ) {
46      this( UNKNOWN, devMsg );
47    }
48  
49    public ValidationException( int type ) {
50      super();
51      this.type = type;
52      if ( type < LOWER || type > UPPER ) {
53        throw new IllegalArgumentException( "invalid type == " + type );
54      }
55    } // ctor(int)
56  
57    public ValidationException( int type, String devMsg ) {
58      super( devMsg );
59      this.type = type;
60      if ( type < LOWER || type > UPPER ) {
61        throw new IllegalArgumentException( "invalid type == " + type );
62      }
63    } // ctor(int,String)
64  
65    public int getType() {
66      return this.type;
67    }
68  
69  } // ValidationException
70  
71  /*
72   * $Log: ValidationException.java,v $
73   * Revision 1.5  2003/02/26 03:38:45  rphall
74   * Added copyright and GPL license
75   *
76   * Revision 1.4  2003/02/19 22:30:31  rphall
77   * Removed gratuitous use of CLRA acronym
78   *
79   * Revision 1.3  2003/02/18 04:24:50  rphall
80   * Added constructor with String parameter
81   */
82