findRepository

public Optional<Repository<? extends Object, ? extends Object>> findRepository(Class<? extends EntityState> stateClass)

Finds a repository by the state class of entities.

This method assumes that a repository for the given entity state class is registered in this context. If there is no such repository, throws an IllegalStateException.

If a repository is registered, the method returns it or empty if the requested entity is not visible.

Return

the requested repository or empty if the repository manages a non-visible entity

Parameters

stateClass

the class of the state of the entity managed by the resulting repository

See also

VisibilityGuard

Throws

if the requested repository is not registered