mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
introduced Projectable interface
This commit is contained in:
parent
c7af7e1173
commit
7dc0433e36
@ -0,0 +1,46 @@
|
||||
package com.mysema.query;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
|
||||
/**
|
||||
* Projectable provides
|
||||
*
|
||||
* @author tiwe
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface Projectable {
|
||||
/**
|
||||
* return the amount of matched rows
|
||||
*/
|
||||
long count();
|
||||
|
||||
/**
|
||||
* iterate over the results with the given projection
|
||||
*/
|
||||
Iterator<Object[]> iterate(Expr<?> e1, Expr<?> e2, Expr<?>... rest);
|
||||
|
||||
/**
|
||||
* iterate over the results with the given projection
|
||||
*/
|
||||
<RT> Iterator<RT> iterate(Expr<RT> projection);
|
||||
|
||||
/**
|
||||
* list the results with the given projection
|
||||
*/
|
||||
List<Object[]> list(Expr<?> e1, Expr<?> e2, Expr<?>... rest);
|
||||
|
||||
/**
|
||||
* list the results with the given projection
|
||||
*/
|
||||
<RT> List<RT> list(Expr<RT> projection);
|
||||
|
||||
/**
|
||||
* return a unique result for the given projection or null for an empty result
|
||||
*/
|
||||
<RT> RT uniqueResult(Expr<RT> expr);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.mysema.query;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
|
||||
/**
|
||||
* ProjectableAdapter provides
|
||||
*
|
||||
* @author tiwe
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class ProjectableAdapter implements Projectable{
|
||||
|
||||
private Projectable projectable;
|
||||
|
||||
public ProjectableAdapter(Projectable projectable){
|
||||
this.projectable = projectable;
|
||||
}
|
||||
|
||||
public long count() {
|
||||
return projectable.count();
|
||||
}
|
||||
|
||||
public Iterator<Object[]> iterate(Expr<?> e1, Expr<?> e2, Expr<?>... rest) {
|
||||
return projectable.iterate(e1, e2, rest);
|
||||
}
|
||||
|
||||
public <RT> Iterator<RT> iterate(Expr<RT> projection) {
|
||||
return projectable.iterate(projection);
|
||||
}
|
||||
|
||||
public List<Object[]> list(Expr<?> e1, Expr<?> e2, Expr<?>... rest) {
|
||||
return projectable.list(e1, e2, rest);
|
||||
}
|
||||
|
||||
public <RT> List<RT> list(Expr<RT> projection) {
|
||||
return projectable.list(projection);
|
||||
}
|
||||
|
||||
public <RT> RT uniqueResult(Expr<RT> expr) {
|
||||
return projectable.uniqueResult(expr);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user