cn.schoolwow.util.domain.query.resource.QueryResource Maven / Gradle / Ivy
package cn.schoolwow.util.domain.query.resource;
import cn.schoolwow.util.module.query.resource.domain.ResourceQueryOption;
import cn.schoolwow.util.module.query.resource.domain.SingleQueryResourceHandler;
public class QueryResource {
private ResourceQueryOption resourceQueryOption = new ResourceQueryOption();
/**
* 创建资源查询对象
* @param name 资源名称
* @param path 资源路径
* */
public static QueryResource newQuery(String name, String path){
QueryResource instanceQuery = new QueryResource();
instanceQuery.resourceQueryOption.name = name;
instanceQuery.resourceQueryOption.path = path;
return instanceQuery;
}
public QueryResource checkExist(boolean checkExist){
resourceQueryOption.checkExist = checkExist;
return this;
}
public QueryResource fileNameStartWith(String fileNameStartWith){
resourceQueryOption.fileFilterOption.fileNameStartWith = fileNameStartWith;
return this;
}
public QueryResource fileNameEndWith(String fileNameEndWith){
resourceQueryOption.fileFilterOption.fileNameEndWith = fileNameEndWith;
return this;
}
public QueryResource singleQueryResourceHandler(SingleQueryResourceHandler singleQueryResourceHandler){
resourceQueryOption.fileFilterOption.singleQueryResourceHandler = singleQueryResourceHandler;
return this;
}
public QueryResourceResponse execute(){
return new QueryResourceResponse(resourceQueryOption);
}
}