Interface DomainRegistry


  • public interface DomainRegistry
    The domain registry provides programmatic access to domain objects.

    Usage for a class without generic parameter:

     MyPolicy policy = domainRegistry.getPolicy(MyPolicy.class,"qualifier");
     

    Usage for a class with generic parameter(s):

     AnotherPolicy<MyClient<Long>> policy = domainRegistry.getPolicy(
         new TypeOf<AnotherPolicy<MyClient<Long>>>(){},
         "qualifier"
     );
     

    Note that generics are specified with a Type instance. In the example above, SeedStack TypeOf is used to capture generics and provide a Type instance but any other implementation can be used.

    • Method Detail

      • getRepository

        <A extends AggregateRoot<I>,​I> Repository<A,​I> getRepository​(Class<A> aggregateRootClass,
                                                                                 Class<I> idClass)
        Get the Repository for an aggregate root.
        Type Parameters:
        A - the type of the aggregate root.
        I - the type of the aggregate root identifier.
        Parameters:
        aggregateRootClass - the aggregate root class.
        idClass - the aggregate root identifier class.
        Returns:
        an instance of the repository.
      • getRepository

        <A extends AggregateRoot<I>,​I> Repository<A,​I> getRepository​(Class<A> aggregateRootClass,
                                                                                 Class<I> idClass,
                                                                                 Class<? extends Annotation> qualifier)
        Get the Repository for an aggregate root and a qualifier.
        Type Parameters:
        A - the type of the aggregate root.
        I - the type of the aggregate root identifier.
        Parameters:
        aggregateRootClass - the aggregate root class.
        idClass - the aggregate root identifier class.
        qualifier - the repository qualifier.
        Returns:
        an instance of the repository.
      • getRepository

        <A extends AggregateRoot<I>,​I> Repository<A,​I> getRepository​(Class<A> aggregateRootClass,
                                                                                 Class<I> idClass,
                                                                                 String qualifier)
        Get the Repository for an aggregate root and a qualifier.
        Type Parameters:
        A - the type of the aggregate root.
        I - the type of the aggregate root identifier.
        Parameters:
        aggregateRootClass - the aggregate root class.
        idClass - the aggregate root identifier class.
        qualifier - the repository qualifier.
        Returns:
        an instance of the repository.
      • getRepository

        <R extends Repository<A,​I>,​A extends AggregateRoot<I>,​I> R getRepository​(Type repositoryType)
        Get a Repository from the domain.
        Type Parameters:
        R - the type of the repository.
        A - the type of the aggregate root.
        I - the type of the aggregate root identifier.
        Parameters:
        repositoryType - the full generic type.
        Returns:
        an instance of the repository.
      • getRepository

        <R extends Repository<A,​I>,​A extends AggregateRoot<I>,​I> R getRepository​(Type repositoryType,
                                                                                                   Class<? extends Annotation> qualifier)
        Get a Repository from the domain.
        Type Parameters:
        R - the type of the repository.
        A - the type of the aggregate root.
        I - the type of the aggregate root identifier.
        Parameters:
        repositoryType - the full generic type.
        qualifier - the repository qualifier.
        Returns:
        an instance of the repository.
      • getRepository

        <R extends Repository<A,​I>,​A extends AggregateRoot<I>,​I> R getRepository​(Type repositoryType,
                                                                                                   String qualifier)
        Get a Repository from the domain.
        Type Parameters:
        R - the type of the repository.
        A - the type of the aggregate root.
        I - the type of the aggregate root identifier.
        Parameters:
        repositoryType - the full generic type.
        qualifier - the repository qualifier.
        Returns:
        an instance of the repository.
      • getFactory

        <P extends ProducibleFactory<P> getFactory​(Class<P> producibleClass)
        Get the Factory for an aggregate root.
        Type Parameters:
        P - the type of the producible object.
        Parameters:
        producibleClass - the producible class.
        Returns:
        an instance of the factory.
      • getFactory

        <P extends ProducibleFactory<P> getFactory​(Class<P> producibleClass,
                                                     Class<? extends Annotation> qualifier)
        Get the Factory with a qualifier for an aggregate root.
        Type Parameters:
        P - the type of the producible object.
        Parameters:
        producibleClass - the producible class.
        qualifier - the factory qualifier.
        Returns:
        an instance of the factory.
      • getFactory

        <P extends ProducibleFactory<P> getFactory​(Class<P> producibleClass,
                                                     String qualifier)
        Get the Factory with a qualifier for an aggregate root.
        Type Parameters:
        P - the type of the producible object.
        Parameters:
        producibleClass - the producible class.
        qualifier - the factory qualifier.
        Returns:
        an instance of the factory.
      • getFactory

        <F extends Factory<P>,​P extends Producible> F getFactory​(Type factoryType)
        Get a Factory from the domain.
        Type Parameters:
        F - the type of the factory.
        P - the type of the producible object.
        Parameters:
        factoryType - the capture of the full generic type.
        Returns:
        an instance of the factory.
      • getFactory

        <F extends Factory<P>,​P extends Producible> F getFactory​(Type factoryType,
                                                                       Class<? extends Annotation> qualifier)
        Get a Factory from the domain.
        Type Parameters:
        F - the type of the factory.
        P - the type of the producible object.
        Parameters:
        factoryType - the full generic type.
        qualifier - the factory qualifier.
        Returns:
        an instance of the factory.
      • getFactory

        <F extends Factory<P>,​P extends Producible> F getFactory​(Type factoryType,
                                                                       String qualifier)
        Get a Factory from the domain.
        Type Parameters:
        F - the type of the factory.
        P - the type of the producible object.
        Parameters:
        factoryType - the full generic type.
        qualifier - the factory qualifier.
        Returns:
        an instance of the factory.
      • getService

        <S> S getService​(Class<S> serviceClass)
        Get a Service from the domain.
        Type Parameters:
        S - the type of the service.
        Parameters:
        serviceClass - the class of the service interface.
        Returns:
        an instance of the service.
      • getService

        <S> S getService​(Class<S> serviceClass,
                         Class<? extends Annotation> qualifier)
        Get a Service with a qualifier from the domain.
        Type Parameters:
        S - the type of the service.
        Parameters:
        serviceClass - the class of the service interface.
        qualifier - the service qualifier.
        Returns:
        an instance of the service.
      • getService

        <S> S getService​(Class<S> serviceClass,
                         String qualifier)
        Get a Service with a qualifier from the domain.
        Type Parameters:
        S - the type of the service.
        Parameters:
        serviceClass - the class of the service interface.
        qualifier - the service qualifier.
        Returns:
        an instance of the service.
      • getService

        <S> S getService​(Type serviceType)
        Get a Service from the domain.
        Type Parameters:
        S - the type of the service.
        Parameters:
        serviceType - the full generic type.
        Returns:
        an instance of the service.
      • getService

        <S> S getService​(Type serviceType,
                         Class<? extends Annotation> qualifier)
        Get a Service from the domain.
        Type Parameters:
        S - the type of the service.
        Parameters:
        serviceType - the full generic type.
        qualifier - the service qualifier.
        Returns:
        an instance of the service.
      • getService

        <S> S getService​(Type serviceType,
                         String qualifier)
        Get a Service from the domain.
        Type Parameters:
        S - the type of the service.
        Parameters:
        serviceType - the full generic type.
        qualifier - the service qualifier.
        Returns:
        an instance of the service.
      • getPolicy

        <P> P getPolicy​(Class<P> policyClass)
        Get a DomainPolicy from the domain.
        Type Parameters:
        P - the type of the policy.
        Parameters:
        policyClass - the policy class.
        Returns:
        an instance of the domain policy.
      • getPolicy

        <P> P getPolicy​(Class<P> policyClass,
                        Class<? extends Annotation> qualifier)
        Get a DomainPolicy with a qualifier from the domain.
        Type Parameters:
        P - the type of the policy.
        Parameters:
        policyClass - the policy class.
        qualifier - the policy qualifier.
        Returns:
        an instance of the domain policy.
      • getPolicy

        <P> P getPolicy​(Class<P> policyClass,
                        String qualifier)
        Get a DomainPolicy with a qualifier from the domain.
        Type Parameters:
        P - the type of the policy.
        Parameters:
        policyClass - the policy class.
        qualifier - the policy qualifier.
        Returns:
        an instance of the domain policy.
      • getPolicy

        <P> P getPolicy​(Type policyType)
        Get a DomainPolicy from the domain.
        Type Parameters:
        P - the type of the policy.
        Parameters:
        policyType - the full generic type.
        Returns:
        an instance of the domain policy.
      • getPolicy

        <P> P getPolicy​(Type policyType,
                        Class<? extends Annotation> qualifier)
        Get a DomainPolicy from the domain.
        Type Parameters:
        P - the type of the policy.
        Parameters:
        policyType - the full generic type.
        qualifier - the policy qualifier.
        Returns:
        an instance of the domain policy.
      • getPolicy

        <P> P getPolicy​(Type policyType,
                        String qualifier)
        Get a DomainPolicy from the domain.
        Type Parameters:
        P - the type of the policy.
        Parameters:
        policyType - the full generic type.
        qualifier - the policy qualifier.
        Returns:
        an instance of the domain policy.