public class Response
extends com.yahoo.component.provider.ListenableFreezableClass
A Response contains a list of Data items, which may (through Data implementations) contain payload data and/or further nested data lists.
Frameworks built on top of processing may subclass this to create a stricter definition of a response. Processors producing Responses should not create subclasses but should instead create additional instances/subclasses of Data. Such Processors should always create Response instances by calling execution.process(request), which will return an empty Response if there are no further processors in the chain.
Modifier and Type | Class and Description |
---|---|
private static class |
Response.CompleteAllOnGetFuture<D extends Data>
A future which on get calls get on all its given futures and sets the value returned from the
first given future as its result.
|
Modifier and Type | Field and Description |
---|---|
private DataList<?> |
data |
private static CompoundName |
freezeListenerKey |
Constructor and Description |
---|
Response(DataList<?> data)
Creates a response containing a list of data
|
Response(Request request)
Creates a request containing an empty array data list
|
Response(Request request,
ErrorMessage errorMessage)
Convenience constructor which adds the given error message to the given request
|
Modifier and Type | Method and Description |
---|---|
private static <D extends Data> |
collectCompletionFutures(DataList<D> dataList,
List<com.google.common.util.concurrent.ListenableFuture<DataList<D>>> futures) |
DataList |
data()
Returns the top level list of data items of this response
|
void |
mergeWith(Response other)
Processors which merges another request into this must call this method to notify the response.
|
static <D extends Data> |
recursiveComplete(DataList<D> rootDataList)
Returns a future in which the given data list and all lists nested within it are completed.
|
addFreezeListener, clone, freeze
private static final CompoundName freezeListenerKey
private final DataList<?> data
public Response(Request request)
public Response(DataList<?> data)
public Response(Request request, ErrorMessage errorMessage)
public void mergeWith(Response other)
public DataList data()
public static <D extends Data> com.google.common.util.concurrent.ListenableFuture<DataList<D>> recursiveComplete(DataList<D> rootDataList)
Lists are completed in prefix, depth-first order. DataLists added after the point when this method is called will not be completed.
rootDataList
- the list to complete recursivelyCopyright © 2018. All rights reserved.