[jOOQ/jOOQ#2370] Add org.jooq.TableType and Table.getType() to describe the type of a table
This commit is contained in:
parent
bab16f8df7
commit
67a12ec93c
@ -124,6 +124,11 @@ public interface Table<R extends Record> extends TableLike<R>, Named {
|
||||
*/
|
||||
Schema getSchema();
|
||||
|
||||
/**
|
||||
* Get the table type.
|
||||
*/
|
||||
TableType getType();
|
||||
|
||||
/**
|
||||
* The comment given to the table.
|
||||
* <p>
|
||||
|
||||
78
jOOQ/src/main/java/org/jooq/TableType.java
Normal file
78
jOOQ/src/main/java/org/jooq/TableType.java
Normal file
@ -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
|
||||
}
|
||||
@ -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<R extends Record> 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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user