View Javadoc
1   /*
2   Copyright (c) 2022 James Ahlborn
3   
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7   
8       http://www.apache.org/licenses/LICENSE-2.0
9   
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15  */
16  
17  package com.healthmarketscience.jackcess;
18  
19  import java.io.IOException;
20  import java.time.LocalDateTime;
21  import java.util.List;
22  
23  /**
24   * The definition of a single database table.  A TableDefinition instance is
25   * retrieved from a {@link TableMetaData} instance.  The TableDefinition
26   * instance only provides access to the table metadata, but no table data.
27   * <p>
28   * A TableDefinition instance is not thread-safe (see {@link Database} for
29   * more thread-safety details).
30   *
31   * @author James Ahlborn
32   * @usage _intermediate_class_
33   */
34  public interface TableDefinition
35  {
36    /**
37     * @return The name of the table
38     * @usage _general_method_
39     */
40    public String getName();
41  
42    /**
43     * Whether or not this table has been marked as hidden.
44     * @usage _general_method_
45     */
46    public boolean isHidden();
47  
48    /**
49     * Whether or not this table is a system (internal) table.
50     * @usage _general_method_
51     */
52    public boolean isSystem();
53  
54    /**
55     * @usage _general_method_
56     */
57    public int getColumnCount();
58  
59    /**
60     * @usage _general_method_
61     */
62    public Database getDatabase();
63  
64    /**
65     * @return All of the columns in this table (unmodifiable List)
66     * @usage _general_method_
67     */
68    public List<? extends Column> getColumns();
69  
70    /**
71     * @return the column with the given name
72     * @usage _general_method_
73     */
74    public Column getColumn(String name);
75  
76    /**
77     * @return the properties for this table
78     * @usage _general_method_
79     */
80    public PropertyMap getProperties() throws IOException;
81  
82    /**
83     * @return the created date for this table if available
84     * @usage _general_method_
85     */
86    public LocalDateTime getCreatedDate() throws IOException;
87  
88    /**
89     * Note: jackcess <i>does not automatically update the modified date of a
90     * Table</i>.
91     *
92     * @return the last updated date for this table if available
93     * @usage _general_method_
94     */
95    public LocalDateTime getUpdatedDate() throws IOException;
96  
97    /**
98     * @return All of the Indexes on this table (unmodifiable List)
99     * @usage _intermediate_method_
100    */
101   public List<? extends Index> getIndexes();
102 
103   /**
104    * @return the index with the given name
105    * @throws IllegalArgumentException if there is no index with the given name
106    * @usage _intermediate_method_
107    */
108   public Index getIndex(String name);
109 
110   /**
111    * @return the primary key index for this table
112    * @throws IllegalArgumentException if there is no primary key index on this
113    *         table
114    * @usage _intermediate_method_
115    */
116   public Index getPrimaryKeyIndex();
117 
118   /**
119    * @return the foreign key index joining this table to the given other table
120    * @throws IllegalArgumentException if there is no relationship between this
121    *         table and the given table
122    * @usage _intermediate_method_
123    */
124   public Index getForeignKeyIndex(Table otherTable);
125 }