Package org.seedstack.business.domain
Interface DomainRegistry
-
public interface DomainRegistryThe 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
Typeinstance. In the example above, SeedStackTypeOfis used to capture generics and provide aTypeinstance but any other implementation can be used.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <P extends Producible>
Factory<P>getFactory(Class<P> producibleClass)Get theFactoryfor an aggregate root.<P extends Producible>
Factory<P>getFactory(Class<P> producibleClass, Class<? extends Annotation> qualifier)Get theFactorywith a qualifier for an aggregate root.<P extends Producible>
Factory<P>getFactory(Class<P> producibleClass, String qualifier)Get theFactorywith a qualifier for an aggregate root.<F extends Factory<P>,P extends Producible>
FgetFactory(Type factoryType)Get aFactoryfrom the domain.<F extends Factory<P>,P extends Producible>
FgetFactory(Type factoryType, Class<? extends Annotation> qualifier)Get aFactoryfrom the domain.<F extends Factory<P>,P extends Producible>
FgetFactory(Type factoryType, String qualifier)Get aFactoryfrom the domain.<P> PgetPolicy(Class<P> policyClass)Get aDomainPolicyfrom the domain.<P> PgetPolicy(Class<P> policyClass, Class<? extends Annotation> qualifier)Get aDomainPolicywith a qualifier from the domain.<P> PgetPolicy(Class<P> policyClass, String qualifier)Get aDomainPolicywith a qualifier from the domain.<P> PgetPolicy(Type policyType)Get aDomainPolicyfrom the domain.<P> PgetPolicy(Type policyType, Class<? extends Annotation> qualifier)Get aDomainPolicyfrom the domain.<P> PgetPolicy(Type policyType, String qualifier)Get aDomainPolicyfrom the domain.<A extends AggregateRoot<I>,I>
Repository<A,I>getRepository(Class<A> aggregateRootClass, Class<I> idClass)Get theRepositoryfor an aggregate root.<A extends AggregateRoot<I>,I>
Repository<A,I>getRepository(Class<A> aggregateRootClass, Class<I> idClass, Class<? extends Annotation> qualifier)Get theRepositoryfor an aggregate root and a qualifier.<A extends AggregateRoot<I>,I>
Repository<A,I>getRepository(Class<A> aggregateRootClass, Class<I> idClass, String qualifier)Get theRepositoryfor an aggregate root and a qualifier.<R extends Repository<A,I>,A extends AggregateRoot<I>,I>
RgetRepository(Type repositoryType)Get aRepositoryfrom the domain.<R extends Repository<A,I>,A extends AggregateRoot<I>,I>
RgetRepository(Type repositoryType, Class<? extends Annotation> qualifier)Get aRepositoryfrom the domain.<R extends Repository<A,I>,A extends AggregateRoot<I>,I>
RgetRepository(Type repositoryType, String qualifier)Get aRepositoryfrom the domain.<S> SgetService(Class<S> serviceClass)Get aServicefrom the domain.<S> SgetService(Class<S> serviceClass, Class<? extends Annotation> qualifier)Get aServicewith a qualifier from the domain.<S> SgetService(Class<S> serviceClass, String qualifier)Get aServicewith a qualifier from the domain.<S> SgetService(Type serviceType)Get aServicefrom the domain.<S> SgetService(Type serviceType, Class<? extends Annotation> qualifier)Get aServicefrom the domain.<S> SgetService(Type serviceType, String qualifier)Get aServicefrom the domain.
-
-
-
Method Detail
-
getRepository
<A extends AggregateRoot<I>,I> Repository<A,I> getRepository(Class<A> aggregateRootClass, Class<I> idClass)
Get theRepositoryfor 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 theRepositoryfor 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 theRepositoryfor 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 aRepositoryfrom 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 aRepositoryfrom 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 aRepositoryfrom 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 Producible> Factory<P> getFactory(Class<P> producibleClass)
Get theFactoryfor 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 Producible> Factory<P> getFactory(Class<P> producibleClass, Class<? extends Annotation> qualifier)
Get theFactorywith 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 Producible> Factory<P> getFactory(Class<P> producibleClass, String qualifier)
Get theFactorywith 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 aFactoryfrom 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 aFactoryfrom 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 aFactoryfrom 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 aServicefrom 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 aServicewith 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 aServicewith 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 aServicefrom 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 aServicefrom 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 aServicefrom 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 aDomainPolicyfrom 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 aDomainPolicywith 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 aDomainPolicywith 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 aDomainPolicyfrom 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 aDomainPolicyfrom 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 aDomainPolicyfrom 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.
-
-