Skip to content

Instantly share code, notes, and snippets.

@secondsun
Created January 11, 2013 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secondsun/4511860 to your computer and use it in GitHub Desktop.
Save secondsun/4511860 to your computer and use it in GitHub Desktop.
A brainstorm for fetching MetaData results for paging from a Pipe
public interface Pipe<T> {
//snip
/**
* These methods MUST add a result to a Map so that a paging context can be looked up
*/
public List<T> read();
public List<T> readWithFilter(ReadFilter filter);
/**
* If a result had a paging context, fetch the context.
*/
public PagingContext getContext(List<T> result);
}
@secondsun
Copy link
Author

Implementations of Pipe will be free to choose how they extract the PagingContext and how they store it. A WeakHashMap is probably one of the better structures to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment