Skip to content

Commit

Permalink
Add missing @Override annotation (#2815)
Browse files Browse the repository at this point in the history
  • Loading branch information
altro3 authored Apr 2, 2024
1 parent 2a86a99 commit 2d3a3c9
Show file tree
Hide file tree
Showing 79 changed files with 166 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public interface BookRepository extends CrudRepository<Book, Long> { // <2>
// end::update2[]

// tag::deleteall[]
@Override
void deleteAll();
// end::deleteall[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@CosmosRepository
public abstract class FamilyRepository implements PageableRepository<Family, String>, JpaSpecificationExecutor<Family> {

@Override
@NonNull
public abstract Optional<Family> findById(@NonNull String id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,7 @@ private interface CriteriaContext extends PropertyParameterCreator {

PersistentPropertyPath getRequiredProperty(String name, Class<?> criterionClazz);

@Override
default int pushParameter(@NonNull BindingParameter bindingParameter, @NonNull BindingParameter.BindingContext bindingContext) {
return getQueryState().pushParameter(bindingParameter, bindingContext);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public BookRepository(AuthorRepository authorRepository) {
/**
* @deprecated Order by 'author.name' case without a join. Hibernate will do the cross join if the association property is accessed by the property path without join.
*/
@Override
@Query(value = "SELECT book_ FROM Book book_", countQuery = "SELECT count(book_) FROM Book book_ ")
@Join(value = "author", type = Join.Type.FETCH)
@Deprecated
Expand Down Expand Up @@ -92,6 +93,7 @@ public BookRepository(AuthorRepository authorRepository) {
@Query("UPDATE Book SET author = :author WHERE id = :id")
public abstract long updateAuthorCustomQuery(Long id, Author author);

@Override
public abstract long updateAuthor(@Id Long id, Author author);

@Query("SELECT b FROM Book b WHERE b.author = :author")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public interface PersonCrudRepository extends JpaRepository<Person, Long>, Perso
@Transactional
List<Person> listPeople(String n);

@Override
@Query(value = "from Person p where p.name like :n",
countQuery = "select count(p) from Person p where p.name like :n")
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@Repository
@Transactional
public interface RatingRepository extends CrudRepository<Rating, UUID> {
@Override
@NotNull
@EntityGraph("RatingEntityGraph")
Optional<Rating> findById(@NotNull UUID id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protected ReactiveFindPageSpecificationInterceptor(@NonNull RepositoryOperations
super(operations);
}

@Override
protected final Pageable getPageable(MethodInvocationContext<?, ?> context) {
final Object parameterValue = context.getParameterValues()[1];
if (parameterValue instanceof Pageable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ default Mono<Person> findOneAndDelete(String name) {
@Transactional
Flux<Person> listPeople(String n);

@Override
@Query(value = "from Person p where p.name like :n",
countQuery = "select count(p) from Person p where p.name like :n")
@Transactional
Mono<Page<Person>> findPeople(String n, Pageable pageable);

@Override
@Query("from Person p where p.name = :n")
@Transactional
Mono<Person> findByName(String n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@Repository
public interface RatingRepository extends ReactorCrudRepository<Rating, UUID> {

@Override
@EntityGraph("RatingEntityGraph")
Mono<Rating> findById(@NotNull UUID id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ public <R> Page<R> findPage(@NonNull PagedQuery<R> query) {
throw new UnsupportedOperationException("The findPage method without an explicit query is not supported. Use findPage(PreparedQuery) instead");
}

@Override
@NonNull
public <T> Iterable<T> persistAll(@NonNull InsertBatchOperation<T> operation) {
return executeWrite(connection -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@JdbcRepository(dialect = Dialect.H2)
public interface H2PatientRepository extends PatientRepository {

@Override
@Query("UPDATE patient SET appointments = :appointments FORMAT JSON WHERE name = :name")
void updateAppointmentsByName(@Parameter String name, @TypeDef(type = DataType.JSON) List<String> appointments);
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public H2PersonRepository(JdbcOperations jdbcOperations) {
this.jdbcOperations = jdbcOperations;
}

@Override
public abstract Person save(String name, int age);

@Override
@Query("INSERT INTO person(name, age, enabled) VALUES (:name, :age, TRUE)")
public abstract int saveCustom(String name, int age);

Expand Down Expand Up @@ -98,4 +100,4 @@ private Map<String, Object> getMap() throws SQLException {
}
return record;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@JdbcRepository(dialect = Dialect.MYSQL)
public interface MySqlPatientRepository extends PatientRepository {

@Override
@Query("UPDATE patient SET appointments = CONVERT(:appointments USING UTF8MB4) WHERE name = :name")
void updateAppointmentsByName(@Parameter String name, @TypeDef(type = DataType.JSON) List<String> appointments);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
@JdbcRepository(dialect = Dialect.MYSQL)
public interface MySqlPersonRepository extends io.micronaut.data.tck.repositories.PersonRepository {

@Override
Person save(String name, int age);

@Override
@Query("INSERT INTO person(name, age, enabled) VALUES (:name, :age, TRUE)")
int saveCustom(String name, int age);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

@JdbcRepository(dialect = Dialect.ORACLE)
public interface OracleXEAuthorRepository extends AuthorRepository {
@Override
@Join(value = "books", type = Join.Type.LEFT_FETCH)
Author queryByName(String name);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ public OracleXEBookRepository(OracleXEAuthorRepository authorRepository) {
super(authorRepository);
}

@Override
@Query(value = "select * from book b where b.title = any (:arg0)", nativeQuery = true)
public abstract List<Book> listNativeBooksWithTitleAnyCollection(@Nullable Collection<String> arg0);

@Override
@Query(value = "select * from book b where b.title = ANY (:arg0)", nativeQuery = true)
public abstract List<Book> listNativeBooksWithTitleAnyArray(@Expandable @TypeDef(type = DataType.STRING) @Nullable String[] arg0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@
@JdbcRepository(dialect = Dialect.ORACLE)
public interface OracleXEPersonRepository extends PersonRepository {

@Override
Person save(String name, int age);

@Override
@Query("INSERT INTO person(id, name, age, enabled) VALUES (\"PERSON_SEQ\".nextval, :name, :age, 1)")
int saveCustom(String name, int age);

@Override
@Query("INSERT INTO person(id, name, age, enabled) VALUES (\"PERSON_SEQ\".nextval, :name, :age, 1)")
int saveCustom(List<Person> people);

@Override
@Query("INSERT INTO person(id, name, age, enabled) VALUES (\"PERSON_SEQ\".nextval, :name, :age, 1)")
int saveCustomSingle(Person people);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface PostgresAuthorRepository extends AuthorRepository {

@Override
@Join(value = "books", type = Join.Type.LEFT_FETCH)
List<Author> listAll();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface PostgresPatientRepository extends PatientRepository {

@Override
@Query("UPDATE patient SET appointments = to_json(:appointments::json) WHERE name = :name")
void updateAppointmentsByName(@Parameter String name, @TypeDef(type = DataType.JSON) List<String> appointments);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface PostgresPersonRepository extends io.micronaut.data.tck.repositories.PersonRepository {

@Override
Person save(String name, int age);

@Override
@Query("INSERT INTO person(name, age, enabled) VALUES (:name, :age, TRUE)")
int saveCustom(String name, int age);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@
@JdbcRepository(dialect = Dialect.SQL_SERVER)
public interface MSSQLPersonRepository extends PersonRepository {

@Override
Person save(String name, int age);

@Override
@Query("INSERT INTO person(name, age, enabled) VALUES (:name, :age, 1)")
int saveCustom(String name, int age);

@Override
@Query("INSERT INTO person(name, age, enabled) VALUES (:name, :age, 1)")
int saveCustom(List<Person> people);

@Override
@Query("INSERT INTO person(name, age, enabled) VALUES (:name, :age, 1)")
int saveCustomSingle(Person people);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ protected FindPageSpecificationInterceptor(@NonNull RepositoryOperations operati
}
}

@Override
protected final Pageable getPageable(MethodInvocationContext<?, ?> context) {
final Object parameterValue = context.getParameterValues()[1];
if (parameterValue instanceof Pageable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ final class DefaultSort implements Sort {
* @param order The order object
* @return The Query instance
*/
@Override
public @NonNull DefaultSort order(@NonNull Order order) {
ArgumentUtils.requireNonNull("order", order);
List<Order> newOrderBy = new ArrayList<>(orderBy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public interface PersistentEntity extends PersistentElement {
*
* @return The entity name
*/
@Override
@NonNull String getName();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public interface PersistentProperty extends PersistentElement {
* The name of the property.
* @return The property name
*/
@Override
@NonNull String getName();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public abstract class AbstractPersistentEntityJoinSupport<J, E> implements Persi

protected final Map<String, PersistentAssociationPath> joins = new LinkedHashMap<>();

@Override
public abstract PersistentEntity getPersistentEntity();

protected abstract <X, Y> PersistentAssociationPath<X, Y> createJoinAssociation(@NonNull Association association,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ DefaultQuery eq(@NonNull String property, @NonNull Object parameter) {
* @param values The values
* @return This query instance
*/
@Override
public @NonNull
DefaultQuery allEq(@NonNull Map<String, Object> values) {
QueryModel.Junction conjunction = conjunction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,7 @@ protected interface CriteriaContext extends PropertyParameterCreator {

QueryPropertyPath getRequiredProperty(String name, Class<?> criterionClazz);

@Override
default void pushParameter(@NonNull BindingParameter bindingParameter, @NonNull BindingParameter.BindingContext bindingContext) {
getQueryState().pushParameter(bindingParameter, bindingContext);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public SqlQueryBuilder(Dialect dialect) {
/**
* @return The dialect being used by the builder.
*/
@Override
public Dialect getDialect() {
return dialect;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ default Map<String, Object> getQueryHints() {
*
* @return true if it is raw query
*/
@Override
boolean isRawQuery();
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public interface StoredQuery<E, R> extends Named, StoredDataOperation<R> {
*
* @return The query result type
*/
@Override
@NonNull
Argument<R> getResultArgument();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public interface BlockingExecutorReactorRepositoryOperations extends RepositoryO

<T> Optional<T> blockOptional(Function<ReactorReactiveRepositoryOperations, Mono<T>> supplier);

@Override
@Nullable
default <T> T findOne(@NonNull Class<T> type, @NonNull Object id) {
return block(reactive -> reactive.findOne(type, id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ private ContextView getContextView() {
return ReactorPropagation.addPropagatedContext(Context.empty(), PropagatedContext.getOrEmpty());
}

@Override
@Nullable
default <T> T findOne(@NonNull Class<T> type, @NonNull Object id) {
return reactive().findOne(type, id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public interface ReactorCriteriaCapableRepository extends ReactiveCriteriaCapabl
/**
* @return The reactive operations.
*/
@Override
@NonNull
ReactorCriteriaRepositoryOperations reactive();
}
Loading

0 comments on commit 2d3a3c9

Please sign in to comment.