org.schmant.project
Class AbstractProjectRepository<T extends ProjectRepository,U extends ProjectRepositoryConfiguration>

java.lang.Object
  extended by org.schmant.project.AbstractProjectRepository<T,U>
All Implemented Interfaces:
ProjectRepository
Direct Known Subclasses:
EclipseWorkspace, IntelliJWorkspace

public abstract class AbstractProjectRepository<T extends ProjectRepository,U extends ProjectRepositoryConfiguration>
extends Object
implements ProjectRepository

Abstract base class for ProjectRepository implementations.

The state of this object is immutable.

Since:
0.7
Author:
Karl Gustafsson

Constructor Summary
protected AbstractProjectRepository(ProjectRepositoryInfoCollector<T,U> pric)
          Constructor.
 
Method Summary
 Project getProject(String name)
          Get the named project.
 U getProjectRepositoryConfiguration()
          Get the project repository configuration.
 Collection<Project> getProjects()
          Get all projects stored in this repository.
 Collection<Project> getProjects(Filter<? super Project> filter)
          Get all projects stored in this repository that passes the supplied filter.
 boolean hasProject(String name)
          Is there a project with the specified name in the project repository?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractProjectRepository

protected AbstractProjectRepository(ProjectRepositoryInfoCollector<T,U> pric)
Constructor. ProjectRepository implementations give this a ProjectRepositoryInfoCollector instance that the constructor uses to populate itself with Project:s.

Parameters:
pric - The info collector.
Method Detail

getProjects

public Collection<Project> getProjects()
Description copied from interface: ProjectRepository
Get all projects stored in this repository.

The returned Project objects are entities. Subsequent calls to this method should return the same Project instances.

Specified by:
getProjects in interface ProjectRepository
Returns:
All projects stored in this repository. Possibly empty, but never null.
See Also:
ProjectRepository.getProjects(Filter)

getProjects

public Collection<Project> getProjects(Filter<? super Project> filter)
Description copied from interface: ProjectRepository
Get all projects stored in this repository that passes the supplied filter.

Specified by:
getProjects in interface ProjectRepository
Parameters:
filter - The filter that a project must pass to be included in the returned set. This filter is often of the type ProjectFilter.
Returns:
The projects stored in this repository that pass the filter. Possibly empty, but never null.
See Also:
ProjectRepository.getProjects(), ProjectFilterUtil

getProject

public Project getProject(String name)
Get the named project.

Specified by:
getProject in interface ProjectRepository
Parameters:
name - The project name.
Returns:
The project, or null if no project with the specified name exists.

hasProject

public boolean hasProject(String name)
Is there a project with the specified name in the project repository?

Specified by:
hasProject in interface ProjectRepository
Parameters:
name - The project name.
Returns:
true if there is a project with the specified name in the project repository.

getProjectRepositoryConfiguration

public U getProjectRepositoryConfiguration()
Get the project repository configuration.

Returns:
The project repository configuration.
Since:
1.1