View Javadoc

1   /* ==============================================================================
2    *   JDBCAdmin, data management software.
3    *   Copyright (C) 2005  Norsys S.A
4    *
5    *   This library is free software; you can redistribute it and/or
6    *   modify it under the terms of the GNU Lesser General Public
7    *   License as published by the Free Software Foundation; either
8    *   version 2.1 of the License, or (at your option) any later version.
9    *
10   *   This library is distributed in the hope that it will be useful,
11   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   *   Lesser General Public License for more details.
14   *
15   *   You should have received a copy of the GNU Lesser General Public
16   *   License along with this library; if not, write to the Free Software
17   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   * ==============================================================================
19   */
20  package jdbcadmin.core.data;
21  
22  import java.io.Serializable;
23  
24  /***
25   * Represents a database schema.
26   */
27  public class Schema implements Comparable, Serializable {
28      /* ----------------------------------------- Attributs */
29      /*** Schema name */
30      private String name;
31  
32      /* ----------------------------------------- Accesseurs */
33      /***
34       * Constructor which specifies the schema name
35       * @param aNom name of the schema
36       */
37      public Schema (String aNom) {
38          name = aNom;
39      }
40  
41      /***
42       * Returns the name.
43       * @return String
44       */
45      public String getName() {
46          return name;
47      }
48  
49      /***
50       * Compares with an other schema.
51       * @throws IllegalArgumentException if <code>aObj</code> is not a Schema
52       * {@inheritDoc}
53       */
54      public int compareTo(Object aObj) {
55          if (aObj instanceof Schema) {
56              return name.compareTo(((Schema) aObj).getName());
57          } else {
58              throw new IllegalArgumentException("Impossible to compare a schema with an other object");
59          }
60      }
61  }