View Javadoc

1   package org.apache.torque;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * The metadata of a column (or pseudocolumn) in a database.
24   *
25   * @version $Id: Column.java 1335473 2012-05-08 12:35:24Z tfischer $
26   */
27  public interface Column
28  {
29      /**
30       * Returns the name of the database column (not prefixed by the table name).
31       *
32       * @return the name of the column, may be null.
33       *         (e.g. for the pseudocoulumn count(*)).
34       *         Is not blank.
35       */
36      String getColumnName();
37  
38      /**
39       * Returns the name of the associated table
40       * (not prefixed by the schema name).
41       *
42       * @return the name of the table, may be null but not blank.
43       */
44      String getTableName();
45  
46      /**
47       * Returns the name of any fixed schema prefix for the column's table
48       * (if any).
49       *
50       * @return the schema name, or null if the schema is not known.
51       */
52      String getSchemaName();
53  
54      /**
55       * Returns the table name prefixed with the schema name if it exists.
56       * I.e. if a schema name exists, the result will be schemaName.tableName,
57       * and otherwise it will just be tableName.
58       *
59       * @return the fully qualified table name of the column,
60       *         may be null but not blank.
61       */
62      String getFullTableName();
63  
64      /**
65       * Returns the SQL expression for the column, qualified by the
66       * table name but not by the schema name.
67       * This can also be a pseudocolumn (e.g. count(*)).
68       *
69       * @return the SQL expression for the column, not null.
70       */
71      String getSqlExpression();
72  }