com.atlassian.jira.sharing.search
Class SharedEntitySearchResult<E extends SharedEntity>

java.lang.Object
  extended by com.atlassian.jira.sharing.search.SharedEntitySearchResult<E>
All Implemented Interfaces:
EnclosedIterable<E>, Sized

public class SharedEntitySearchResult<E extends SharedEntity>
extends Object
implements EnclosedIterable<E>

A pair that contains the result status of SharedEntity search. It contains the actual results and a boolean value that indicates whether or not more results are still available. It also contains the total number of results found, which may be greater than the original page size requested.

Since:
v3.13

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.util.collect.EnclosedIterable
EnclosedIterable.Functions, EnclosedIterable.ListResolver<T>
 
Constructor Summary
SharedEntitySearchResult(EnclosedIterable<E> results, boolean hasNext, int totalResultCount)
           
 
Method Summary
 void foreach(Consumer<E> sink)
          Apply the sink to all elements in the Collection.
 List<E> getResults()
          Prefer the foreach(Consumer) method if the result size is large as it doesn't load everything into memory.
 int getTotalResultCount()
           
 boolean hasMoreResults()
           
 boolean isEmpty()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedEntitySearchResult

public SharedEntitySearchResult(EnclosedIterable<E> results,
                                boolean hasNext,
                                int totalResultCount)
Method Detail

getResults

public List<E> getResults()
Prefer the foreach(Consumer) method if the result size is large as it doesn't load everything into memory.

Returns:
a list of results

hasMoreResults

public boolean hasMoreResults()

getTotalResultCount

public int getTotalResultCount()
Returns:
the total number of results found in a search. This will always be >= size()

foreach

public final void foreach(Consumer<E> sink)
Description copied from interface: EnclosedIterable
Apply the sink to all elements in the Collection.

Specified by:
foreach in interface EnclosedIterable<E extends SharedEntity>

size

public int size()
Specified by:
size in interface EnclosedIterable<E extends SharedEntity>
Specified by:
size in interface Sized
Returns:
the likely size of the objects passed into the sink in EnclosedIterable.foreach(Consumer). Be careful depending on this size being exact, as in many cases its best efforts value or may be stable due to concurrent changes.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface EnclosedIterable<E extends SharedEntity>
Specified by:
isEmpty in interface Sized
Returns:
true if the there is no data behind it.


Copyright © 2002-2009 Atlassian. All Rights Reserved.