Interface Domain

All Known Implementing Classes:
DefaultDomain

public interface Domain
Represents an application domain model, entities, reports and database operations.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    configureConnection(is.codion.common.db.connection.DatabaseConnection connection)
    Configures a database connection for applications using this domain model, for example adding extensions or properties.
    default void
    configureDatabase(is.codion.common.db.database.Database database)
    Configures a database, for example run migration scripts.
    static List<Domain>
     
     
    <C, T, R> is.codion.common.db.operation.DatabaseFunction<C,T,R>
    function(is.codion.common.db.operation.FunctionType<C,T,R> functionType)
    Retrieves the function of the given type.
    Map<is.codion.common.db.operation.FunctionType<?,?,?>,is.codion.common.db.operation.DatabaseFunction<?,?,?>>
     
    <C, T> is.codion.common.db.operation.DatabaseProcedure<C,T>
    procedure(is.codion.common.db.operation.ProcedureType<C,T> procedureType)
    Retrieves the procedure of the given type.
    Map<is.codion.common.db.operation.ProcedureType<?,?>,is.codion.common.db.operation.DatabaseProcedure<?,?>>
     
    <T, R, P> is.codion.common.db.report.Report<T,R,P>
    report(is.codion.common.db.report.ReportType<T,R,P> reportType)
    Retrieves the report of the given type.
    Map<is.codion.common.db.report.ReportType<?,?,?>,is.codion.common.db.report.Report<?,?,?>>
     
     
  • Method Details

    • type

      DomainType type()
      Returns:
      the domain type identifying this domain model
    • entities

      Entities entities()
      Returns:
      the Domain entities
    • reports

      Map<is.codion.common.db.report.ReportType<?,?,?>,is.codion.common.db.report.Report<?,?,?>> reports()
      Returns:
      an unmodifiable view of this domain's reports
    • procedures

      Map<is.codion.common.db.operation.ProcedureType<?,?>,is.codion.common.db.operation.DatabaseProcedure<?,?>> procedures()
      Returns:
      an unmodifiable view of this domain's procedures
    • functions

      Map<is.codion.common.db.operation.FunctionType<?,?,?>,is.codion.common.db.operation.DatabaseFunction<?,?,?>> functions()
      Returns:
      an unmodifiable view of this domain's functions
    • report

      <T, R, P> is.codion.common.db.report.Report<T,R,P> report(is.codion.common.db.report.ReportType<T,R,P> reportType)
      Retrieves the report of the given type.
      Type Parameters:
      T - the report type
      R - the report result type
      P - the report parameters type
      Parameters:
      reportType - the report type
      Returns:
      the report
      Throws:
      IllegalArgumentException - in case the report is not found
    • procedure

      <C, T> is.codion.common.db.operation.DatabaseProcedure<C,T> procedure(is.codion.common.db.operation.ProcedureType<C,T> procedureType)
      Retrieves the procedure of the given type.
      Type Parameters:
      C - the type of the database connection this procedure requires
      T - the argument type
      Parameters:
      procedureType - the procedure type
      Returns:
      the procedure
      Throws:
      IllegalArgumentException - in case the procedure is not found
    • function

      <C, T, R> is.codion.common.db.operation.DatabaseFunction<C,T,R> function(is.codion.common.db.operation.FunctionType<C,T,R> functionType)
      Retrieves the function of the given type.
      Type Parameters:
      C - the type of the database connection this function requires
      T - the argument type
      R - the result type
      Parameters:
      functionType - the function type
      Returns:
      the function
      Throws:
      IllegalArgumentException - in case the function is not found
    • configureConnection

      default void configureConnection(is.codion.common.db.connection.DatabaseConnection connection) throws is.codion.common.db.exception.DatabaseException
      Configures a database connection for applications using this domain model, for example adding extensions or properties. Called each time a new connection based on this domain is created.
      Parameters:
      connection - the connection to configure
      Throws:
      is.codion.common.db.exception.DatabaseException - in case of an exception
    • configureDatabase

      default void configureDatabase(is.codion.common.db.database.Database database) throws is.codion.common.db.exception.DatabaseException
      Configures a database, for example run migration scripts. Only called once per database instance.
      Parameters:
      database - the database
      Throws:
      is.codion.common.db.exception.DatabaseException - in case of an exception
    • domains

      static List<Domain> domains()
      Returns:
      a list containing all the Domains registered with ServiceLoader.