Package com.mysql.cj.xdevapi
Interface Schema
- All Superinterfaces:
DatabaseObject
- All Known Implementing Classes:
SchemaImpl
public interface Schema extends DatabaseObject
A client-side representation of a database schema. Provides access to the schema contents.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSchema.CreateCollectionOptionsDefines options to be passed tocreateCollection(String, CreateCollectionOptions).static classSchema.ModifyCollectionOptionsDefines options to be passed tomodifyCollection(String, ModifyCollectionOptions).static classSchema.ValidationValidation options to be passed tocreateCollection(String, CreateCollectionOptions)ormodifyCollection(String, ModifyCollectionOptions).Nested classes/interfaces inherited from interface com.mysql.cj.xdevapi.DatabaseObject
DatabaseObject.DbObjectStatus, DatabaseObject.DbObjectType -
Method Summary
Modifier and Type Method Description CollectioncreateCollection(java.lang.String name)Create a new collection.CollectioncreateCollection(java.lang.String name, boolean reuseExisting)Create a new collection if it does not already exist on the server.CollectioncreateCollection(java.lang.String collectionName, Schema.CreateCollectionOptions options)Create a new collection.voiddropCollection(java.lang.String collectionName)Drop the collection from this schema.CollectiongetCollection(java.lang.String name)Retrieve a reference to the named collection.CollectiongetCollection(java.lang.String name, boolean requireExists)Retrieve a reference to the named collection hinting that an exception should be thrown if the collection is not known to the server.TablegetCollectionAsTable(java.lang.String name)Retrieve a reference to the named collection using the table API.java.util.List<Collection>getCollections()Retrieve the set of collections existing in this schema.java.util.List<Collection>getCollections(java.lang.String pattern)Retrieve the set of collections existing in this schema and matching the given pattern.TablegetTable(java.lang.String name)Retrieve a reference to the named table.TablegetTable(java.lang.String tableName, boolean requireExists)Retrieve a reference to the named table hinting that an exception should be thrown if the collection is not known to the server.java.util.List<Table>getTables()Retrieve the set of tables existing in this schema.java.util.List<Table>getTables(java.lang.String pattern)Retrieve the set of tables existing in this schema and matching the given pattern.voidmodifyCollection(java.lang.String collectionName, Schema.ModifyCollectionOptions options)Modify the schema validation of a collection.Methods inherited from interface com.mysql.cj.xdevapi.DatabaseObject
existsInDatabase, getName, getSchema, getSession
-
Method Details
-
getCollections
java.util.List<Collection> getCollections()Retrieve the set of collections existing in this schema.- Returns:
- list of
Collectionobjects
-
getCollections
Retrieve the set of collections existing in this schema and matching the given pattern.- Parameters:
pattern- match pattern- Returns:
- list of
Collectionobjects
-
getTables
java.util.List<Table> getTables()Retrieve the set of tables existing in this schema.- Returns:
- list of
Tableobjects
-
getTables
Retrieve the set of tables existing in this schema and matching the given pattern.- Parameters:
pattern- match pattern- Returns:
- list of
Tableobjects
-
getCollection
Retrieve a reference to the named collection.- Parameters:
name- collection name- Returns:
Collection
-
getCollection
Retrieve a reference to the named collection hinting that an exception should be thrown if the collection is not known to the server.- Parameters:
name- collection namerequireExists- true if required to exist- Returns:
Collection
-
getCollectionAsTable
Retrieve a reference to the named collection using the table API.- Parameters:
name- collection name- Returns:
Table
-
getTable
Retrieve a reference to the named table.- Parameters:
name- table name- Returns:
Table
-
getTable
Retrieve a reference to the named table hinting that an exception should be thrown if the collection is not known to the server.- Parameters:
tableName- table namerequireExists- true if required to exist- Returns:
Table
-
createCollection
Create a new collection.- Parameters:
name- collection name- Returns:
Collection
-
createCollection
Create a new collection if it does not already exist on the server.- Parameters:
name- collection namereuseExisting- true if allowed to reuse- Returns:
Collection
-
createCollection
Collection createCollection(java.lang.String collectionName, Schema.CreateCollectionOptions options)Create a new collection.- Parameters:
collectionName- collection nameoptions- reuseExisting, validation level and JSON schema options- Returns:
Collection
-
modifyCollection
Modify the schema validation of a collection.- Parameters:
collectionName- collection nameoptions- validation level and JSON schema options
-
dropCollection
void dropCollection(java.lang.String collectionName)Drop the collection from this schema.- Parameters:
collectionName- name of collection to drop
-