BoundedContext

public abstract class BoundedContext implements Closeable

A logical and structural boundary of a model.

Logically, a Bounded Context represents a sub-system built to be described with the same Ubiquitous Language. Any term within a single bounded context has a single meaning and may or may not map to another term in the language of another Bounded Context.

The Ubiquitous Language of a Bounded Context is represented by such concepts as the entity state, event, and command types, entity types, and others. An entity and its adjacent types belong to the Bounded Context which the entity Repository is registered in.

Structurally, a Bounded Context brings together all the infrastructure required for the components of a model to cooperate.

An instance of BoundedContext acts as a major point of configuration for all the model elements which belong to it.

See also

<a href="https://martinfowler.com/bliki/BoundedContext.html">

Martin Fowler on Bounded Contexts

Inheritors

Constructors

Link copied to clipboard
protected void BoundedContext(BoundedContextBuilder builder)
Creates new instance.

Types

Link copied to clipboard
public final class InternalAccess
Provides access to features of BoundedContext used internally by the framework.

Functions

Link copied to clipboard
public void close()
Closes the BoundedContext performing all necessary clean-ups.
Link copied to clipboard
Obtains instance of CommandBus of this BoundedContext.
Link copied to clipboard
public EventBus eventBus()
Obtains instance of EventBus of this BoundedContext.
Link copied to clipboard
public boolean hasEntitiesOfType(Class<? extends Entity<? extends Object, ? extends Object>> entityClass)
Verifies if this Bounded Context contains entities of the passed class.
Link copied to clipboard
public boolean hasEntitiesWithState(Class<? extends EntityState> stateClass)
Verifies if this Bounded Context has entities with the state of the passed class.
Link copied to clipboard
Obtains instance of ImportBus of this BoundedContext.
Link copied to clipboard
protected final void init()
Performs post-creation initialization of the instance.
Link copied to clipboard
Provides access to features of the context used internally by the framework.
Link copied to clipboard
public boolean isMultitenant()
Returns true if the Bounded Context is designed to serve more than one tenant of the application, false otherwise.
Link copied to clipboard
public boolean isOpen()
Tells if the object is still open.
Link copied to clipboard
Creates a new builder for a multitenant BoundedContext.
Link copied to clipboard
public BoundedContextName name()
Obtains an ID of the Bounded Context.
Link copied to clipboard
protected final void register(Repository<? extends Object, ? extends Object> repository)
Adds the passed repository to the context.
Link copied to clipboard
protected void registerCommandDispatcher(CommandDispatcher dispatcher)
Registers the passed command dispatcher with the CommandBus.
Link copied to clipboard
protected void registerEventDispatcher(EventDispatcher dispatcher)
Registering the passed event dispatcher with the buses of this context.
Link copied to clipboard
Creates a new builder for a single tenant BoundedContext.
Link copied to clipboard
public ContextSpec spec()
Obtains specification of this context.
Link copied to clipboard
public Stand stand()
Obtains instance of Stand of this BoundedContext.
Link copied to clipboard
public Set<TypeName> stateTypes()
Obtains the set of all entity type names.
public Set<TypeName> stateTypes(Visibility visibility)
Obtains a set of entity type names by their visibility.
Link copied to clipboard
public abstract SystemClient systemClient()
Obtains instance of SystemClient of this BoundedContext.
Link copied to clipboard
public String toString()
Returns the name of this Bounded Context.

Inherited functions

Link copied to clipboard
public void checkOpen()
Ensures that the object is open.