gu.sql2java.ListAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sql2java-manager Show documentation
Show all versions of sql2java-manager Show documentation
sql2java manager class package for accessing database
package gu.sql2java;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.LinkedList;
import java.util.List;
import com.google.common.base.Function;
import gu.sql2java.pagehelper.Page;
import gu.sql2java.pagehelper.PageHelper;
/**
* @author guyadong
*
* @param
* @since 3.18.3
*/
class ListAction implements TableManager.Action {
final List list;
public ListAction() {
this(false);
}
/**
* @param nopage disable page helper if true
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public ListAction(boolean nopage) {
Page page;
if(!nopage && null != (page = PageHelper.getLocalPage()) && page.isEnable()){
list = page;
}else{
list = new LinkedList<>();
}
}
public List getList() {
return list;
}
@SuppressWarnings("unchecked")
public List getList(Functiontransformer) {
return PageHelper.transform(list,checkNotNull(transformer,"transformer is null"));
}
@Override
public void call(B bean) {
list.add(bean);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy