com.mysema.query.support
Class ProjectableAdapter<P extends Projectable>

java.lang.Object
  extended by com.mysema.query.support.ProjectableAdapter<P>
All Implemented Interfaces:
Projectable

public class ProjectableAdapter<P extends Projectable>
extends Object
implements Projectable

ProjectableAdapter is an adapter implementation for the Projectable interface

Author:
tiwe

Constructor Summary
ProjectableAdapter(P projectable)
           
 
Method Summary
 long count()
          return the amount of matched rows
 long countDistinct()
          return the amount of distinct matched rows
 boolean exists()
           
protected  P getProjectable()
           
 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> expr)
          list the distinct results for the given projection
<RT> SearchResults<RT>
listResults(Expression<RT> expr)
          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> expr)
          return a single result for the given projection or null if no result is found
 String toString()
           
 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> expr)
          return a unique result for the given projection or null if no result is found
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProjectableAdapter

public ProjectableAdapter(P projectable)
Method Detail

getProjectable

protected P getProjectable()

count

public long count()
Description copied from interface: Projectable
return the amount of matched rows

Specified by:
count in interface Projectable

countDistinct

public long countDistinct()
Description copied from interface: Projectable
return the amount of distinct matched rows

Specified by:
countDistinct in interface Projectable

exists

public boolean exists()
Specified by:
exists in interface Projectable
Returns:
true, if rows matching the given criteria exist, otherwise false

notExists

public boolean notExists()
Specified by:
notExists in interface Projectable
Returns:
true, if no rows matching the given criteria exist, otherwise false

iterate

public com.mysema.commons.lang.CloseableIterator<Object[]> iterate(Expression<?> first,
                                                                   Expression<?> second,
                                                                   Expression<?>... rest)
Description copied from interface: Projectable
iterate over the results for the given projection

Specified by:
iterate in interface Projectable
Returns:
an Iterator over the projection

iterate

public com.mysema.commons.lang.CloseableIterator<Object[]> iterate(Expression<?>[] args)
Description copied from interface: Projectable
iterate over the results for the given projection

Specified by:
iterate in interface Projectable
Returns:

iterate

public <RT> com.mysema.commons.lang.CloseableIterator<RT> iterate(Expression<RT> projection)
Description copied from interface: Projectable
iterate over the results for the given projection

Specified by:
iterate in interface Projectable
Type Parameters:
RT - generic type of the Iterator
Returns:
an Iterator over the projection

iterateDistinct

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

Specified by:
iterateDistinct in interface Projectable
Returns:
an Iterator over the projection

iterateDistinct

public com.mysema.commons.lang.CloseableIterator<Object[]> iterateDistinct(Expression<?>[] args)
Description copied from interface: Projectable
iterate over the distinct results for the given projection

Specified by:
iterateDistinct in interface Projectable
Returns:

iterateDistinct

public <RT> com.mysema.commons.lang.CloseableIterator<RT> iterateDistinct(Expression<RT> projection)
Description copied from interface: Projectable
iterate over the distinct results for the given projection

Specified by:
iterateDistinct in interface Projectable
Type Parameters:
RT - generic type of the Iteratpr
Returns:
an Iterator over the projection

list

public List<Object[]> list(Expression<?> first,
                           Expression<?> second,
                           Expression<?>... rest)
Description copied from interface: Projectable
list the results for the given projection An empty list is returned for no results.

Specified by:
list in interface Projectable
rest - rest
Returns:
a List over the projection

list

public List<Object[]> list(Expression<?>[] args)
Description copied from interface: Projectable
list the results for the given projection An empty list is returned for no results.

Specified by:
list in interface Projectable
Returns:

list

public <RT> List<RT> list(Expression<RT> projection)
Description copied from interface: Projectable
list the results for the given projection An empty list is returned for no results.

Specified by:
list in interface Projectable
Type Parameters:
RT - generic type of the List
Returns:
a List over the projection

listDistinct

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

Specified by:
listDistinct in interface Projectable
rest - rest
Returns:
a List over the projection

listDistinct

public List<Object[]> listDistinct(Expression<?>[] args)
Description copied from interface: Projectable
list the distinct results for the given projection An empty list is returned for no results.

Specified by:
listDistinct in interface Projectable
Returns:

listDistinct

public <RT> List<RT> listDistinct(Expression<RT> projection)
Description copied from interface: Projectable
list the distinct results for the given projection An empty list is returned for no results.

Specified by:
listDistinct in interface Projectable
Type Parameters:
RT - generic type of the List
Returns:
a List over the projection

listDistinctResults

public <RT> SearchResults<RT> listDistinctResults(Expression<RT> expr)
Description copied from interface: Projectable
list the distinct results for the given projection

Specified by:
listDistinctResults in interface Projectable
Returns:

listResults

public <RT> SearchResults<RT> listResults(Expression<RT> expr)
Description copied from interface: Projectable
list the results for the given projection

Specified by:
listResults in interface Projectable
Returns:

map

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

Specified by:
map in interface Projectable
Returns:

toString

public String toString()
Overrides:
toString in class Object

singleResult

public Object[] singleResult(Expression<?> first,
                             Expression<?> second,
                             Expression<?>... rest)
Description copied from interface: Projectable
return a single result for the given projection or null if no result is found

for multiple results only the first one is returned

Specified by:
singleResult in interface Projectable
Returns:

singleResult

public Object[] singleResult(Expression<?>[] args)
Description copied from interface: Projectable
return a single result for the given projection or null if no result is found

for multiple results only the first one is returned

Specified by:
singleResult in interface Projectable
Returns:

singleResult

public <RT> RT singleResult(Expression<RT> expr)
Description copied from interface: Projectable
return a single result for the given projection or null if no result is found

for multiple results only the first one is returned

Specified by:
singleResult in interface Projectable
Type Parameters:
RT - return type
Returns:
the result or null for an empty result

uniqueResult

public Object[] uniqueResult(Expression<?> first,
                             Expression<?> second,
                             Expression<?>... rest)
Description copied from interface: Projectable
return a unique result for the given projection or null if no result is found

Specified by:
uniqueResult in interface Projectable
Returns:

uniqueResult

public Object[] uniqueResult(Expression<?>[] args)
Description copied from interface: Projectable
return a unique result for the given projection or null if no result is found

Specified by:
uniqueResult in interface Projectable
Returns:

uniqueResult

public <RT> RT uniqueResult(Expression<RT> expr)
Description copied from interface: Projectable
return a unique result for the given projection or null if no result is found

Specified by:
uniqueResult in interface Projectable
Type Parameters:
RT - return type
Returns:
the result or null for an empty result


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