public interface

RepositorySupplier

com.atlassian.stash.repository.RepositorySupplier
Known Indirect Subclasses

Class Overview

Allows retrieving repositories by their ID or project and slug.

This is a simplification of the RepositoryService, intended to be used in cases where a component needs to be able to look up repositories but doesn't need the full service functionality. Using this interface instead makes such components easier to test.

Plugin developers: Plugins cannot autowire their components when importing both RepositorySupplier and RepositoryService. In general, if a plugin needs RepositoryService methods, it should only use the RepositoryService. This interface should be used when a plugin only needs to retrieve repositories.

Summary

Public Methods
@Nullable Repository getById(int id)
Retrieves a Repository by its ID.
@Nullable Repository getBySlug(String projectKey, String slug)
Retrieves a Repository by its slug.

Public Methods

@Nullable public Repository getById (int id)

Retrieves a Repository by its ID.

Parameters
id the repository's ID
Returns
  • the request repository, or null if there is no repository with the specified ID or the current user does not have access to it

@Nullable public Repository getBySlug (String projectKey, String slug)

Retrieves a Repository by its slug. Slugs are only unique within a given Project, so the project key is also required.

Parameters
projectKey the key of the project to search in
slug the slug of the repository to search for
Returns
  • the repository, or null if no project matches the specified slug within the specified project