io.hypersistence.utils.hibernate.query.ListResultTransformer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hypersistence-utils-hibernate-62 Show documentation
Show all versions of hypersistence-utils-hibernate-62 Show documentation
Utilities for Spring and Hibernate ORM 6.2 or newer
package io.hypersistence.utils.hibernate.query;
import org.hibernate.transform.ResultTransformer;
import java.util.List;
/**
* The {@link ListResultTransformer} simplifies the way
* we can use a ResultTransformer by defining a default implementation for the
* {@link ResultTransformer#transformList(List)} method.
*
* This way, the {@link ListResultTransformer} can be used
* as a functional interface.
*
* For more details about how to use it, check out this article on vladmihalcea.com.
*
* @author Vlad Mihalcea
* @since 2.9.0
*/
@FunctionalInterface
public interface ListResultTransformer extends ResultTransformer {
/**
* Default implementation returning the tuples list as-is.
*
* @param tuples tuples list
* @return tuples list
*/
@Override
default List transformList(List tuples) {
return tuples;
}
}