diff --git a/jOOQ/src/main/java/org/jooq/Table.java b/jOOQ/src/main/java/org/jooq/Table.java index bc7daafd73..9b4dc7f5b1 100644 --- a/jOOQ/src/main/java/org/jooq/Table.java +++ b/jOOQ/src/main/java/org/jooq/Table.java @@ -124,6 +124,11 @@ public interface Table extends TableLike, Named { */ Schema getSchema(); + /** + * Get the table type. + */ + TableType getType(); + /** * The comment given to the table. *

diff --git a/jOOQ/src/main/java/org/jooq/TableType.java b/jOOQ/src/main/java/org/jooq/TableType.java new file mode 100644 index 0000000000..dca877d31f --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/TableType.java @@ -0,0 +1,78 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A description of the type of a {@link Table}. + * + * @author Lukas Eder + */ +public enum TableType { + + /** + * An ordinary table that is stored in the schema. + */ + TABLE, + + /** + * A global temporary table that is stored in the schema and visible to + * everyone. + */ + TEMPORARY, + + /** + * A view that is defined by a {@link Select} statement. + */ + VIEW, + + /** + * A materialised view that is defined by a {@link Select} statement, and + * whose data is materialised in the schema. + */ + MATERIALIZED_VIEW, + + /** + * A table valued function that is defined by a {@link Routine}. + */ + FUNCTION, + + /** + * A table type that is unknown to jOOQ. + */ + UNKNOWN +} diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java index 8c1e6b8670..aee5c4135b 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java @@ -105,6 +105,7 @@ import org.jooq.TableOnStep; import org.jooq.TableOptionalOnStep; import org.jooq.TableOuterJoinStep; import org.jooq.TablePartitionByStep; +import org.jooq.TableType; import org.jooq.UniqueKey; // ... // ... @@ -412,6 +413,11 @@ abstract class AbstractTable extends AbstractNamed implements // XXX: Table API // ------------------------------------------------------------------------ + @Override + public final TableType getType() { + return TableType.UNKNOWN; + } + @Override public final Catalog getCatalog() { return getSchema() == null ? null : getSchema().getCatalog();