org.xblackcat.sjpu.storage.consumer.SingletonConsumer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sjpu-dbah Show documentation
Show all versions of sjpu-dbah Show documentation
Service for generating DB access logic in simple way via interfaces and annotations
package org.xblackcat.sjpu.storage.consumer;
import org.xblackcat.sjpu.storage.ConsumeException;
/**
* Default consumer for reading single row. If result set has more than
*
* @author xBlackCat
*/
public class SingletonConsumer implements IRowSetConsumer {
private T obj;
private boolean set = false;
@Override
public boolean consume(T o) throws ConsumeException {
if (set) {
throw new ConsumeException("Expected one or zero results on query ");
}
obj = o;
set = true;
return false;
}
public T getRowsHolder() {
return obj;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy