Interface DatabaseManager


  • public interface DatabaseManager
    • Method Summary

      Modifier and Type Method Description
      Database defineDatabase​(java.lang.String name, java.util.function.Consumer<Database.ModelConstructor> func)
      Defines a database in the persistence system.
      Bot getBot()
      Gets the bot instance this database manager is connected with.
      default Database getDatabase​(java.lang.String name)
      Gets a pre-existing, defined database, if such a database exists.
      java.util.Collection<Database> getDatabases()
      Gets an immutable list of all defined databases in this provider.
    • Method Detail

      • getBot

        Bot getBot()
        Gets the bot instance this database manager is connected with.
        Returns:
        Bot instance.
      • getDatabases

        java.util.Collection<Database> getDatabases()
        Gets an immutable list of all defined databases in this provider.
        Returns:
        Database collection.
      • getDatabase

        default Database getDatabase​(java.lang.String name)
        Gets a pre-existing, defined database, if such a database exists.
        Parameters:
        name - Database name.
        Returns:
        Database instance if found, null otherwise.
      • defineDatabase

        Database defineDatabase​(java.lang.String name,
                                java.util.function.Consumer<Database.ModelConstructor> func)
        Defines a database in the persistence system.
        Parameters:
        name - Database name
        func - Function used to construct the database model.
        Returns:
        Database instance.