add lots @Override annotations and some generic type args in Jpa types

removed an unused and unimplemented interface
This commit is contained in:
Gavin 2023-07-06 09:24:58 +02:00 committed by Gavin King
parent 41fe405aa7
commit 98a83a082c
12 changed files with 33 additions and 37 deletions

View File

@ -1,13 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.query.criteria;
/**
* @author Steve Ebersole
*/
public interface JpaDmlCriteria<E> {
}

View File

@ -17,6 +17,7 @@ public interface JpaInPredicate<T> extends JpaPredicate, CriteriaBuilder.In<T>
* list of values.
* @return expression
*/
@Override
JpaExpression<T> getExpression();
/**
@ -24,6 +25,7 @@ public interface JpaInPredicate<T> extends JpaPredicate, CriteriaBuilder.In<T>
* @param value value
* @return in predicate
*/
@Override
JpaInPredicate<T> value(T value);
/**

View File

@ -33,6 +33,7 @@ public interface JpaMapJoin<O,K,V> extends JpaPluralJoin<O, Map<K, V>, V>, MapJo
@Override
JpaMapJoin<O, K, V> on(Predicate... restrictions);
@Override
<S extends V> JpaMapJoin<O, K, S> treatAs(Class<S> treatAsType);
@Override

View File

@ -22,15 +22,21 @@ public interface JpaPluralJoin<O, C, E> extends JpaJoin<O, E>, PluralJoin<O, C,
@Override
PluralPersistentAttribute<? super O, C, E> getAttribute();
@Override
JpaPluralJoin<O, ? extends C, E> on(JpaExpression<Boolean> restriction);
@Override
JpaPluralJoin<O, ? extends C, E> on(Expression<Boolean> restriction);
@Override
JpaPluralJoin<O, ? extends C, E> on(JpaPredicate... restrictions);
@Override
JpaPluralJoin<O, ? extends C, E> on(Predicate... restrictions);
@Override
<S extends E> JpaPluralJoin<O, ?, S> treatAs(Class<S> treatAsType);
@Override
<S extends E> JpaPluralJoin<O, ?, S> treatAs(EntityDomainType<S> treatAsType);
}

View File

@ -27,12 +27,16 @@ public interface JpaQueryGroup<T> extends JpaQueryPart<T> {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Covariant overrides
@Override
JpaQueryGroup<T> setSortSpecifications(List<? extends JpaOrder> sortSpecifications);
@Override
JpaQueryGroup<T> setOffset(JpaExpression<?> offset);
@Override
JpaQueryGroup<T> setFetch(JpaExpression<?> fetch);
@Override
JpaQueryGroup<T> setFetch(JpaExpression<?> fetch, FetchClauseType fetchClauseType);
}

View File

@ -31,11 +31,11 @@ public interface JpaQueryPart<T> extends JpaCriteriaNode {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Limit/Offset/Fetch clause
<X> JpaExpression<X> getOffset();
JpaExpression<?> getOffset();
JpaQueryPart<T> setOffset(JpaExpression<?> offset);
<X> JpaExpression<X> getFetch();
JpaExpression<?> getFetch();
JpaQueryPart<T> setFetch(JpaExpression<?> fetch);

View File

@ -34,11 +34,11 @@ public interface JpaQueryStructure<T> extends JpaQueryPart<T> {
boolean isDistinct();
JpaQueryStructure setDistinct(boolean distinct);
JpaQueryStructure<T> setDistinct(boolean distinct);
JpaSelection<T> getSelection();
JpaQueryStructure setSelection(JpaSelection<T> selection);
JpaQueryStructure<T> setSelection(JpaSelection<T> selection);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -48,7 +48,7 @@ public interface JpaQueryStructure<T> extends JpaQueryPart<T> {
List<? extends JpaRoot<?>> getRootList();
JpaQueryStructure addRoot(JpaRoot<?> root);
JpaQueryStructure<T> addRoot(JpaRoot<?> root);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -66,7 +66,7 @@ public interface JpaQueryStructure<T> extends JpaQueryPart<T> {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Grouping (group-by / having) clause
List<? extends JpaExpression> getGroupingExpressions();
List<? extends JpaExpression<?>> getGroupingExpressions();
JpaQueryStructure<T> setGroupingExpressions(List<? extends JpaExpression<?>> grouping);
@ -83,11 +83,15 @@ public interface JpaQueryStructure<T> extends JpaQueryPart<T> {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Covariant overrides
@Override
JpaQueryStructure<T> setSortSpecifications(List<? extends JpaOrder> sortSpecifications);
@Override
JpaQueryStructure<T> setOffset(JpaExpression<?> offset);
@Override
JpaQueryStructure<T> setFetch(JpaExpression<?> fetch);
@Override
JpaQueryStructure<T> setFetch(JpaExpression<?> fetch, FetchClauseType fetchClauseType);
}

View File

@ -6,6 +6,7 @@
*/
package org.hibernate.query.criteria;
import java.util.Collections;
import java.util.List;
import jakarta.persistence.criteria.Selection;
@ -18,9 +19,8 @@ public interface JpaSelection<T> extends JpaTupleElement<T>, Selection<T> {
List<? extends JpaSelection<?>> getSelectionItems();
@Override
@SuppressWarnings("unchecked")
default List<Selection<?>> getCompoundSelectionItems() {
return (List) getSelectionItems();
return Collections.unmodifiableList( getSelectionItems() );
}
@Override

View File

@ -9,7 +9,6 @@ package org.hibernate.query.criteria;
import java.util.Set;
import org.hibernate.metamodel.model.domain.EntityDomainType;
import org.hibernate.metamodel.model.domain.PluralPersistentAttribute;
import jakarta.persistence.criteria.Expression;
import jakarta.persistence.criteria.Predicate;
@ -22,15 +21,20 @@ import jakarta.persistence.criteria.SetJoin;
*/
public interface JpaSetJoin<O, T> extends JpaPluralJoin<O, Set<T>, T>, SetJoin<O, T> {
@Override
JpaSetJoin<O, T> on(JpaExpression<Boolean> restriction);
JpaSetJoin<O, T> on(Expression<Boolean> restriction);
@Override
JpaSetJoin<O, T> on(JpaPredicate... restrictions);
@Override
JpaSetJoin<O, T> on(Predicate... restrictions);
@Override
<S extends T> JpaSetJoin<O, S> treatAs(Class<S> treatAsType);
@Override
<S extends T> JpaSetJoin<O, S> treatAs(EntityDomainType<S> treatAsType);
}

View File

@ -24,10 +24,12 @@ public interface SqmDmlStatement<E> extends SqmStatement<E>, SqmCteContainer, Jp
/**
* Get the root path that is the target of the DML statement.
*/
@Override
SqmRoot<E> getTarget();
/**
* Set the root path
*/
@Override
void setTarget(JpaRoot<E> root);
}

View File

@ -143,12 +143,11 @@ public abstract class SqmQueryPart<T> implements SqmVisitableNode, JpaQueryPart<
}
//noinspection unchecked
getOrderByClause().setSortSpecifications( (List) sortSpecifications );
getOrderByClause().setSortSpecifications( (List<SqmSortSpecification>) sortSpecifications );
return this;
}
@SuppressWarnings("unchecked")
@Override
public SqmExpression<?> getOffset() {
return getOffsetExpression();
@ -160,7 +159,6 @@ public abstract class SqmQueryPart<T> implements SqmVisitableNode, JpaQueryPart<
return this;
}
@SuppressWarnings("unchecked")
@Override
public SqmExpression<?> getFetch() {
return getFetchExpression();

View File

@ -444,24 +444,12 @@ public class SqmQuerySpec<T> extends SqmQueryPart<T>
return this;
}
@Override
@SuppressWarnings("unchecked")
public SqmExpression<?> getOffset() {
return getOffsetExpression();
}
@Override
public SqmQuerySpec<T> setOffset(JpaExpression<?> offset) {
setOffsetExpression( (SqmExpression<?>) offset );
return this;
}
@Override
@SuppressWarnings("unchecked")
public SqmExpression<?> getFetch() {
return getFetchExpression();
}
@Override
public SqmQuerySpec<T> setFetch(JpaExpression<?> fetch) {
setFetchExpression( (SqmExpression<?>) fetch );