io.micronaut.data.repository.jpa.async.AsyncJpaSpecificationExecutor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of micronaut-data-model Show documentation
Show all versions of micronaut-data-model Show documentation
Data Repository Support for Micronaut
The newest version!
/*
* Copyright 2017-2021 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.data.repository.jpa.async;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.data.model.Page;
import io.micronaut.data.model.Pageable;
import io.micronaut.data.model.Sort;
import io.micronaut.data.repository.jpa.criteria.DeleteSpecification;
import io.micronaut.data.repository.jpa.criteria.PredicateSpecification;
import io.micronaut.data.repository.jpa.criteria.QuerySpecification;
import io.micronaut.data.repository.jpa.criteria.UpdateSpecification;
import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
* Interface representing async version of {@link io.micronaut.data.repository.jpa.JpaSpecificationExecutor}.
*
* @param The entity type
* @author Denis Stepanov
* @since 3.2
*/
public interface AsyncJpaSpecificationExecutor {
/**
* Returns a single entity matching the given {@link QuerySpecification}.
*
* @param spec The query specification
* @param The entity type
* @return optional found result
*/
@NonNull
CompletableFuture findOne(@Nullable QuerySpecification spec);
/**
* Returns a single entity matching the given {@link PredicateSpecification}.
*
* @param spec The query specification
* @param The result type
* @return optional found result
*/
@NonNull
CompletableFuture findOne(@Nullable PredicateSpecification spec);
/**
* Returns all entities matching the given {@link QuerySpecification}.
*
* @param spec The query specification
* @param The result type
* @return found results
*/
@NonNull
CompletableFuture extends List> findAll(@Nullable QuerySpecification spec);
/**
* Returns all entities matching the given {@link PredicateSpecification}.
*
* @param spec The query specification
* @param The result type
* @return found results
*/
@NonNull
CompletableFuture extends List> findAll(@Nullable PredicateSpecification spec);
/**
* Returns a {@link Page} of entities matching the given {@link QuerySpecification}.
*
* @param spec The query specification
* @param pageable The pageable object
* @return a page
*/
@NonNull
CompletableFuture> findAll(@Nullable QuerySpecification spec, Pageable pageable);
/**
* Returns a {@link Page} of entities matching the given {@link PredicateSpecification}.
*
* @param spec The query specification
* @param pageable The pageable object
* @return a page
*/
@NonNull
CompletableFuture> findAll(@Nullable PredicateSpecification spec, Pageable pageable);
/**
* Returns all entities matching the given {@link QuerySpecification} and {@link Sort}.
*
* @param spec The query specification
* @param sort The sort object
* @param The result type
* @return found results
*/
@NonNull
CompletableFuture extends List> findAll(@Nullable QuerySpecification spec, Sort sort);
/**
* Returns all entities matching the given {@link QuerySpecification} and {@link Sort}.
*
* @param spec The query specification
* @param sort The sort object
* @param The result type
* @return found results
*/
@NonNull
CompletableFuture extends List> findAll(@Nullable PredicateSpecification spec, Sort sort);
/**
* Returns the number of instances that the given {@link QuerySpecification} will return.
*
* @param spec The query specification
* @return the number of instances.
*/
@NonNull
CompletableFuture count(@Nullable QuerySpecification spec);
/**
* Returns the number of instances that the given {@link QuerySpecification} will return.
*
* @param spec The query specification
* @return the number of instances.
*/
@NonNull
CompletableFuture count(@Nullable PredicateSpecification spec);
/**
* Returns whether an instance was found for the given {@link QuerySpecification}.
*
* @param spec The query specification
* @return the number of instances.
* @since 3.8
*/
@NonNull
CompletableFuture exists(@Nullable QuerySpecification spec);
/**
* Returns whether an instance was found for the given {@link PredicateSpecification}.
*
* @param spec The query specification
* @return the number of instances.
* @since 3.8
*/
@NonNull
CompletableFuture exists(@Nullable PredicateSpecification spec);
/**
* Deletes all entities matching the given {@link DeleteSpecification}.
*
* @param spec The delete specification
* @return the number records deleted.
*/
@NonNull
CompletableFuture deleteAll(@Nullable DeleteSpecification spec);
/**
* Deletes all entities matching the given {@link PredicateSpecification}.
*
* @param spec The delete specification
* @return the number records deleted.
*/
@NonNull
CompletableFuture deleteAll(@Nullable PredicateSpecification spec);
/**
* Updates all entities matching the given {@link UpdateSpecification}.
*
* @param spec The update specification
* @return the number records updated.
*/
@NonNull
CompletableFuture updateAll(@Nullable UpdateSpecification spec);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy