com.mysema.query
Interface Projectable

All Known Subinterfaces:
ColQuery, JDOQLQuery, JPQLQuery, SQLQuery
All Known Implementing Classes:
AbstractColQuery, AbstractHibernateQuery, AbstractHibernateSQLQuery, AbstractJDOQLQuery, AbstractJPAQuery, AbstractJPASQLQuery, AbstractSQLQuery, AbstractSQLQuery, AbstractSQLQuery, ColQueryImpl, HibernateQuery, HibernateSQLQuery, JDOQLQueryImpl, JDOSQLQuery, JPAQuery, JPASQLQuery, JPQLQueryBase, MySQLQuery, OracleQuery, PostgresQuery, ProjectableAdapter, ProjectableQuery, SQLQueryImpl, SQLServerQuery

public interface Projectable

Projectable defines default projection methods for Query implementations. All Querydsl query implementations should implement either this interface or SimpleProjectable.

Author:
tiwe
See Also:
SimpleProjectable

Method Summary
 long count()
          return the amount of matched rows
 long countDistinct()
          return the amount of distinct matched rows
 boolean exists()
           
 com.mysema.commons.lang.CloseableIterator<Object[]> iterate(Expression<?>[] args)
          iterate over the results for the given projection
 com.mysema.commons.lang.CloseableIterator<Object[]> iterate(Expression<?> first, Expression<?> second, Expression<?>... rest)
          iterate over the results for the given projection
<RT> com.mysema.commons.lang.CloseableIterator<RT>
iterate(Expression<RT> projection)
          iterate over the results for the given projection
 com.mysema.commons.lang.CloseableIterator<Object[]> iterateDistinct(Expression<?>[] args)
          iterate over the distinct results for the given projection
 com.mysema.commons.lang.CloseableIterator<Object[]> iterateDistinct(Expression<?> first, Expression<?> second, Expression<?>... rest)
          iterate over the distinct results for the given projection
<RT> com.mysema.commons.lang.CloseableIterator<RT>
iterateDistinct(Expression<RT> projection)
          iterate over the distinct results for the given projection
 List<Object[]> list(Expression<?>[] args)
          list the results for the given projection An empty list is returned for no results.
 List<Object[]> list(Expression<?> first, Expression<?> second, Expression<?>... rest)
          list the results for the given projection An empty list is returned for no results.
<RT> List<RT>
list(Expression<RT> projection)
          list the results for the given projection An empty list is returned for no results.
 List<Object[]> listDistinct(Expression<?>[] args)
          list the distinct results for the given projection An empty list is returned for no results.
 List<Object[]> listDistinct(Expression<?> first, Expression<?> second, Expression<?>... rest)
          list the distinct results for the given projection An empty list is returned for no results.
<RT> List<RT>
listDistinct(Expression<RT> projection)
          list the distinct results for the given projection An empty list is returned for no results.
<RT> SearchResults<RT>
listDistinctResults(Expression<RT> projection)
          list the distinct results for the given projection
<RT> SearchResults<RT>
listResults(Expression<RT> projection)
          list the results for the given projection
<K,V> Map<K,V>
map(Expression<K> key, Expression<V> value)
          return the given projection as a Map instance using key and value for Map population An empty map is returned for no results.
 boolean notExists()
           
 Object[] singleResult(Expression<?>[] args)
          return a single result for the given projection or null if no result is found
 Object[] singleResult(Expression<?> first, Expression<?> second, Expression<?>... rest)
          return a single result for the given projection or null if no result is found
<RT> RT
singleResult(Expression<RT> projection)
          return a single result for the given projection or null if no result is found
<T> T
transform(ResultTransformer<T> transformer)
          Apply the given transformer to this Projectable instance and return the results
 Object[] uniqueResult(Expression<?>[] args)
          return a unique result for the given projection or null if no result is found
 Object[] uniqueResult(Expression<?> first, Expression<?> second, Expression<?>... rest)
          return a unique result for the given projection or null if no result is found
<RT> RT
uniqueResult(Expression<RT> projection)
          return a unique result for the given projection or null if no result is found
 

Method Detail

count

@Nonnegative
long count()
return the amount of matched rows


countDistinct

@Nonnegative
long countDistinct()
return the amount of distinct matched rows


exists

boolean exists()
Returns:
true, if rows matching the given criteria exist, otherwise false

notExists

boolean notExists()
Returns:
true, if no rows matching the given criteria exist, otherwise false

iterate

com.mysema.commons.lang.CloseableIterator<Object[]> iterate(Expression<?> first,
                                                            Expression<?> second,
                                                            Expression<?>... rest)
iterate over the results for the given projection

Parameters:
first -
second -
rest -
Returns:
an Iterator over the projection

iterate

com.mysema.commons.lang.CloseableIterator<Object[]> iterate(Expression<?>[] args)
iterate over the results for the given projection

Parameters:
args -
Returns:

iterate

<RT> com.mysema.commons.lang.CloseableIterator<RT> iterate(Expression<RT> projection)
iterate over the results for the given projection

Type Parameters:
RT - generic type of the Iterator
Parameters:
projection -
Returns:
an Iterator over the projection

iterateDistinct

com.mysema.commons.lang.CloseableIterator<Object[]> iterateDistinct(Expression<?> first,
                                                                    Expression<?> second,
                                                                    Expression<?>... rest)
iterate over the distinct results for the given projection

Parameters:
first -
second -
rest -
Returns:
an Iterator over the projection

iterateDistinct

com.mysema.commons.lang.CloseableIterator<Object[]> iterateDistinct(Expression<?>[] args)
iterate over the distinct results for the given projection

Parameters:
args -
Returns:

iterateDistinct

<RT> com.mysema.commons.lang.CloseableIterator<RT> iterateDistinct(Expression<RT> projection)
iterate over the distinct results for the given projection

Type Parameters:
RT - generic type of the Iteratpr
Parameters:
projection -
Returns:
an Iterator over the projection

list

List<Object[]> list(Expression<?> first,
                    Expression<?> second,
                    Expression<?>... rest)
list the results for the given projection An empty list is returned for no results.

Parameters:
first -
second -
rest - rest
Returns:
a List over the projection

list

List<Object[]> list(Expression<?>[] args)
list the results for the given projection An empty list is returned for no results.

Parameters:
args -
Returns:

list

<RT> List<RT> list(Expression<RT> projection)
list the results for the given projection An empty list is returned for no results.

Type Parameters:
RT - generic type of the List
Parameters:
projection -
Returns:
a List over the projection

listDistinct

List<Object[]> listDistinct(Expression<?> first,
                            Expression<?> second,
                            Expression<?>... rest)
list the distinct results for the given projection An empty list is returned for no results.

Parameters:
first -
second -
rest - rest
Returns:
a List over the projection

listDistinct

List<Object[]> listDistinct(Expression<?>[] args)
list the distinct results for the given projection An empty list is returned for no results.

Parameters:
args -
Returns:

listDistinct

<RT> List<RT> listDistinct(Expression<RT> projection)
list the distinct results for the given projection An empty list is returned for no results.

Type Parameters:
RT - generic type of the List
Parameters:
projection -
Returns:
a List over the projection

listResults

<RT> SearchResults<RT> listResults(Expression<RT> projection)
list the results for the given projection

Type Parameters:
RT -
Parameters:
projection -
Returns:

listDistinctResults

<RT> SearchResults<RT> listDistinctResults(Expression<RT> projection)
list the distinct results for the given projection

Type Parameters:
RT -
Parameters:
projection -
Returns:

map

<K,V> Map<K,V> map(Expression<K> key,
                   Expression<V> value)
return the given projection as a Map instance using key and value for Map population An empty map is returned for no results.

Type Parameters:
K -
V -
Parameters:
key -
value -
Returns:

singleResult

@Nullable
Object[] singleResult(Expression<?> first,
                               Expression<?> second,
                               Expression<?>... rest)
return a single result for the given projection or null if no result is found

for multiple results only the first one is returned

Parameters:
first -
second -
rest -
Returns:

singleResult

@Nullable
Object[] singleResult(Expression<?>[] args)
return a single result for the given projection or null if no result is found

There is some ambiguity for missing results and null valued results, for disambiguation use the list or iterate methods instead.

for multiple results only the first one is returned

Parameters:
args -
Returns:

singleResult

@Nullable
<RT> RT singleResult(Expression<RT> projection)
return a single result for the given projection or null if no result is found

There is some ambiguity for missing results and null valued results, for disambiguation use the list or iterate methods instead.

for multiple results only the first one is returned

Type Parameters:
RT - return type
Parameters:
projection -
Returns:
the result or null for an empty result

transform

<T> T transform(ResultTransformer<T> transformer)
Apply the given transformer to this Projectable instance and return the results

Type Parameters:
T -
Parameters:
transformer -
Returns:

uniqueResult

@Nullable
Object[] uniqueResult(Expression<?> first,
                               Expression<?> second,
                               Expression<?>... rest)
return a unique result for the given projection or null if no result is found

There is some ambiguity for missing results and null valued results, for disambiguation use the list or iterate methods instead.

Parameters:
first -
second -
rest -
Returns:
Throws:
NonUniqueResultException - if there is more than one matching result

uniqueResult

@Nullable
Object[] uniqueResult(Expression<?>[] args)
return a unique result for the given projection or null if no result is found

There is some ambiguity for missing results and null valued results, for disambiguation use the list or iterate methods instead.

Parameters:
args -
Returns:
Throws:
NonUniqueResultException - if there is more than one matching result

uniqueResult

@Nullable
<RT> RT uniqueResult(Expression<RT> projection)
return a unique result for the given projection or null if no result is found

There is some ambiguity for missing results and null valued results, for disambiguation use the list or iterate methods instead.

Type Parameters:
RT - return type
Parameters:
projection -
Returns:
the result or null for an empty result
Throws:
NonUniqueResultException - if there is more than one matching result


Copyright © 2007-2012 Mysema Ltd. All Rights Reserved.