additional clean up of - "massive" cleanout of the transformers stuff

This commit is contained in:
Steve Ebersole 2022-01-15 08:50:14 -06:00
parent c43b6ff606
commit c0137e7de2
4 changed files with 31 additions and 12 deletions

View File

@ -131,6 +131,8 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* by default each result in the list is packaged in an array of type * by default each result in the list is packaged in an array of type
* {@code Object[]}. * {@code Object[]}.
* *
* @implNote Delegates to {@link #list()}
*
* @return the results as a list * @return the results as a list
*/ */
default List<R> getResultList() { default List<R> getResultList() {
@ -146,6 +148,10 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* The client should call {@link Stream#close()} after processing the * The client should call {@link Stream#close()} after processing the
* stream so that resources are freed as soon as possible. * stream so that resources are freed as soon as possible.
* *
* @implNote Delegates to {@link #stream()}, which in turn delegates
* to this method. Implementors should implement at least one of
* these methods.
*
* @return The results as a {@link Stream} * @return The results as a {@link Stream}
*/ */
default Stream<R> getResultStream() { default Stream<R> getResultStream() {
@ -217,6 +223,10 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* *
* @return The results as a {@link Stream} * @return The results as a {@link Stream}
* *
* @implNote Delegates to {@link #getResultStream()}, which in turn
* delegates to this method. Implementors should implement at least
* one of these methods.
*
* @since 5.2 * @since 5.2
*/ */
default Stream<R> stream() { default Stream<R> stream() {

View File

@ -8,16 +8,21 @@ package org.hibernate.query;
import java.util.List; import java.util.List;
import org.hibernate.Incubating;
/** /**
* Defines some processing performed on the result {@link List} of a * Defines some processing performed on the overall result {@link List}
* {@link org.hibernate.Query} before the result list is returned to * of a {@link Query} before the result list is returned to the caller.
* the caller of {@link org.hibernate.Query#getResultList()}.
* *
* @see org.hibernate.transform.ResultTransformer * @see Query#setResultListTransformer
* @see Query#list
* @see Query#getResultList
* @see TupleTransformer
* *
* @author Steve Ebersole * @author Steve Ebersole
* @author Gavin King * @author Gavin King
*/ */
@Incubating
@FunctionalInterface @FunctionalInterface
public interface ResultListTransformer<T> { public interface ResultListTransformer<T> {
/** /**

View File

@ -6,28 +6,32 @@
*/ */
package org.hibernate.query; package org.hibernate.query;
import org.hibernate.Incubating;
import org.hibernate.sql.results.internal.RowTransformerTupleTransformerAdapter; import org.hibernate.sql.results.internal.RowTransformerTupleTransformerAdapter;
import java.util.List; import java.util.List;
/** /**
* Defines some transformation applied to each result of a {@link org.hibernate.Query} * Defines some transformation applied to each result of a {@link Query}
* before the results are packaged as a {@link List} and returned to the caller of * before the results are packaged as a {@link List} and returned to the caller. Each result
* {@link org.hibernate.Query#getResultList()}. Each query result is received as a * is received as a tuple (that is, as an {@code Object[]}), and may be transformed to
* tuple, that is, as an array of type {@code Object[]}, and may be transformed to
* some other type. * some other type.
* <p> *
* Every {@code TupleTransformer} is automatically wrapped in an instance of * @implNote Every {@code TupleTransformer} is automatically wrapped in an instance of
* {@link RowTransformerTupleTransformerAdapter}, adapting it to the * {@link RowTransformerTupleTransformerAdapter}, adapting it to the
* {@link org.hibernate.sql.results.spi.RowTransformer} contract, which is always * {@link org.hibernate.sql.results.spi.RowTransformer} contract, which is always
* used to actually process the results internally. * used to actually process the results internally.
* *
* @see org.hibernate.transform.ResultTransformer * @see Query#setTupleTransformer
* @see Query#list
* @see Query#getResultList
* @see ResultListTransformer
* @see org.hibernate.sql.results.spi.RowTransformer * @see org.hibernate.sql.results.spi.RowTransformer
* *
* @author Steve Ebersole * @author Steve Ebersole
* @author Gavin King * @author Gavin King
*/ */
@Incubating
@FunctionalInterface @FunctionalInterface
public interface TupleTransformer<T> { public interface TupleTransformer<T> {
/** /**

View File

@ -21,7 +21,7 @@ import org.hibernate.query.TupleTransformer;
* *
* @author Gavin King * @author Gavin King
* *
* @deprecated Use {@link TupleTransformer} and/or {@link ResultListTransformer} * @deprecated (since 6.0) Use {@link TupleTransformer} and/or {@link ResultListTransformer} instead
*/ */
@Deprecated @Deprecated
public interface ResultTransformer<T> extends TupleTransformer<T>, ResultListTransformer<T>, Serializable { public interface ResultTransformer<T> extends TupleTransformer<T>, ResultListTransformer<T>, Serializable {