Package io.manebot.database
Interface Database.ModelConstructor
-
- Enclosing interface:
- Database
public static interface Database.ModelConstructor
Database model constructor.
-
-
Method Summary
Modifier and Type Method Description Database.ModelConstructor
addDependency(Database database)
Depends on another database, associating those models with this model.java.lang.ClassLoader
getClassLoader()
Gets the ClassLoader being used to load resources defined by this model constructor.java.lang.String
getDatabaseName()
Gets the database name.Database
getSystemDatabase()
Gets the system database.Database.ModelConstructor
registerEntity(java.lang.Class<?> entityClass)
Registers an entity in the persistence system for this database.<X,Y extends X>
Database.ModelConstructorregisterEntityAssociation(java.lang.Class<Y> entityClass, java.lang.Class<X> virtualClass)
Registers an entity in the persistence system for this database.Database.ModelConstructor
setClassLoader(java.lang.ClassLoader classLoader)
Applies the instance classloader of this model constructor, used to load the classes defined by it.Database.ModelConstructor
setUpdateSchema(boolean updateSchema)
Sets the database schema update behavior flag.boolean
willUpdateSchema()
Finds if the database will update its schema for the unrecognized entities which have been registered.
-
-
-
Method Detail
-
getClassLoader
java.lang.ClassLoader getClassLoader()
Gets the ClassLoader being used to load resources defined by this model constructor.- Returns:
- immutable collection of all class loaders being utilized in this session.
-
setClassLoader
Database.ModelConstructor setClassLoader(java.lang.ClassLoader classLoader)
Applies the instance classloader of this model constructor, used to load the classes defined by it.- Parameters:
classLoader
- ClassLoader instance.- Returns:
- ModelConstructor instance.
-
getDatabaseName
java.lang.String getDatabaseName()
Gets the database name.- Returns:
- Database name.
-
getSystemDatabase
Database getSystemDatabase()
Gets the system database.- Returns:
- system database.
-
addDependency
Database.ModelConstructor addDependency(Database database)
Depends on another database, associating those models with this model.- Parameters:
database
- Database to depend on.- Returns:
- ModelConstructor instance.
-
registerEntity
Database.ModelConstructor registerEntity(java.lang.Class<?> entityClass)
Registers an entity in the persistence system for this database.- Parameters:
entityClass
- Entity class.- Returns:
- ModelConstructor instance.
-
registerEntityAssociation
<X,Y extends X> Database.ModelConstructor registerEntityAssociation(java.lang.Class<Y> entityClass, java.lang.Class<X> virtualClass)
Registers an entity in the persistence system for this database.- Parameters:
virtualClass
- class by which this entity is also accessible.entityClass
- entity class to associate this entity type to.- Returns:
- ModelConstructor instance.
-
willUpdateSchema
boolean willUpdateSchema()
Finds if the database will update its schema for the unrecognized entities which have been registered.- Returns:
- true if the existing database schema will be validated.
-
setUpdateSchema
Database.ModelConstructor setUpdateSchema(boolean updateSchema)
Sets the database schema update behavior flag.- Parameters:
updateSchema
- true if the schema should be validated for update, false otherwise.- Returns:
- ModelConstructor instance.
-
-