org.hibernate.result.internal.ResultSetOutputImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
JPMS Module-Info's for a few of the Jakarta Libraries just until they add them in themselves
/*
* 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 .
*/
package org.hibernate.result.internal;
import java.sql.ResultSet;
import java.util.List;
import java.util.function.Supplier;
import javax.enterprise.inject.spi.Producer;
import org.hibernate.result.ResultSetOutput;
/**
* Implementation of ResultSetOutput
*
* @author Steve Ebersole
*/
class ResultSetOutputImpl implements ResultSetOutput {
private final Supplier resultSetSupplier;
public ResultSetOutputImpl(List results) {
this.resultSetSupplier = () -> results;
}
public ResultSetOutputImpl(Supplier resultSetSupplier) {
this.resultSetSupplier = resultSetSupplier;
}
@Override
public boolean isResultSet() {
return true;
}
@Override
@SuppressWarnings("unchecked")
public List getResultList() {
return resultSetSupplier.get();
}
@Override
public Object getSingleResult() {
final List results = getResultList();
if ( results == null || results.isEmpty() ) {
return null;
}
else {
return results.get( 0 );
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy