Class DefaultDomain

    • Constructor Detail

      • DefaultDomain

        protected DefaultDomain​(DomainType domainType)
        Instantiates a new DefaultDomain identified by the given DomainType.
        Parameters:
        domainType - the Domain model type to associate with this domain model
    • Method Detail

      • type

        public final DomainType type()
        Specified by:
        type in interface Domain
        Returns:
        the domain type
      • entities

        public final Entities entities()
        Specified by:
        entities in interface Domain
        Returns:
        the Domain entities
      • reports

        public final Map<ReportType<?,​?,​?>,​Report<?,​?,​?>> reports()
        Specified by:
        reports in interface Domain
        Returns:
        an unmodifiable view of this domain's reports
      • report

        public final <T,​R,​P> Report<T,​R,​P> report​(ReportType<T,​R,​P> reportType)
        Description copied from interface: Domain
        Retrieves the report of the given type.
        Specified by:
        report in interface Domain
        Type Parameters:
        T - the report type
        R - the report result type
        P - the report parameters type
        Parameters:
        reportType - the report type
        Returns:
        the report
      • procedure

        public final <C,​T> DatabaseProcedure<C,​T> procedure​(ProcedureType<C,​T> procedureType)
        Description copied from interface: Domain
        Retrieves the procedure of the given type.
        Specified by:
        procedure in interface Domain
        Type Parameters:
        C - the type of the database connection this procedure requires
        T - the argument type
        Parameters:
        procedureType - the procedure type
        Returns:
        the procedure
      • function

        public final <C,​T,​R> DatabaseFunction<C,​T,​R> function​(FunctionType<C,​T,​R> functionType)
        Description copied from interface: Domain
        Retrieves the function of the given type.
        Specified by:
        function in interface Domain
        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
      • add

        protected final <T,​R,​P> void add​(ReportType<T,​R,​P> reportType,
                                                     Report<T,​R,​P> report)
        Adds a report to this domain model.
        Type Parameters:
        T - the report type
        R - the report result type
        P - the report parameters type
        Parameters:
        reportType - the report to add
        report - the actual report to associate with the report type
        Throws:
        RuntimeException - in case loading the report failed
        IllegalArgumentException - in case the report has already been added
      • add

        protected final <C,​T> void add​(ProcedureType<C,​T> procedureType,
                                             DatabaseProcedure<C,​T> procedure)
        Adds the given procedure to this domain
        Type Parameters:
        C - the connection type
        T - the argument type
        Parameters:
        procedureType - the procedure type to identify the procedure
        procedure - the procedure to add
        Throws:
        IllegalArgumentException - in case a procedure has already been associated with the given type
      • add

        protected final <C,​T,​R> void add​(FunctionType<C,​T,​R> functionType,
                                                     DatabaseFunction<C,​T,​R> function)
        Adds the given function to this domain
        Type Parameters:
        C - the connection type
        T - the argument type
        R - the result type
        Parameters:
        functionType - the function type to identify the function
        function - the function to add
        Throws:
        IllegalArgumentException - in case a function has already been associated with the given type
      • setStrictForeignKeys

        protected final void setStrictForeignKeys​(boolean strictForeignKeys)
        Specifies whether it should be possible to define foreign keys referencing entities that have not been defined, this can be disabled in cases where entities have circular references.
        Parameters:
        strictForeignKeys - true for strict foreign key validation
      • addEntities

        protected final void addEntities​(Domain domain)
        Adds all the entities from the given domain to this domain. Note that the entity type names must be unique.
        Parameters:
        domain - the domain model which entities to add
        Throws:
        IllegalArgumentException - in case a non-unique entity type name is encountered
        See Also:
        EntityType.name()
      • addProcedures

        protected final void addProcedures​(Domain domain)
        Adds all the procedures from the given domain to this domain.
        Parameters:
        domain - the domain model which procedures to add
      • addFunctions

        protected final void addFunctions​(Domain domain)
        Adds all the functions from the given domain to this domain.
        Parameters:
        domain - the domain model which functions to add
      • addReports

        protected final void addReports​(Domain domain)
        Adds all the reports from the given domain to this domain.
        Parameters:
        domain - the domain model which reports to add