All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.katharsis.repository.NotFoundRepository Maven / Gradle / Ivy

There is a newer version: 2.6.3
Show newest version
package io.katharsis.repository;

import io.katharsis.queryParams.QueryParams;
import io.katharsis.repository.exception.RepositoryNotFoundException;

import java.io.Serializable;

/**
 * Represents a non-existing repository. It is assigned to a resource class if Katharsis couldn't find any repository.
 */
public class NotFoundRepository implements ResourceRepository {

    private final Class repositoryClass;

    public NotFoundRepository(Class repositoryClass) {
        this.repositoryClass = repositoryClass;
    }

    @Override
    public T findOne(ID id, QueryParams queryParams) {
        throw new RepositoryNotFoundException(repositoryClass);
    }

    @Override
    public Iterable findAll(QueryParams queryParams) {
        throw new RepositoryNotFoundException(repositoryClass);
    }

    @Override
    public Iterable findAll(Iterable ids, QueryParams queryParams) {
        throw new RepositoryNotFoundException(repositoryClass);
    }

    @Override
    public void delete(ID id) {
        throw new RepositoryNotFoundException(repositoryClass);
    }

    @Override
    public  S save(S entity) {
        throw new RepositoryNotFoundException(repositoryClass);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy