1 // Copyright 2012 Google. All Rights Reserved.
2 package com
.google
.appengine
.api
.datastore
;
4 import java
.util
.Arrays
;
8 * Concrete {@link CallbackContext} implementation that is specific to
9 * intercepted operations that load {@link Entity Entities}, currently get
10 * and "query". It is important to note that when a PostLoadContext is
11 * provided to a callback following a get operation, {@link #getElements()}
12 * returns all retrieved Entities. However, when a PostLoadContext is provided
13 * to a callback following a query, a separate PostLoadContext will be
14 * constructed for each Entity in the result set so {@link #getElements()} will
15 * only return a {@link List} containing a single Entity. This is due to the
16 * streaming nature of query responses.
19 public final class PostLoadContext
extends BaseCallbackContext
<Entity
> {
21 PostLoadContext(CurrentTransactionProvider currentTransactionProvider
,
22 List
<Entity
> results
) {
23 super(currentTransactionProvider
, results
);
26 PostLoadContext(CurrentTransactionProvider currentTransactionProvider
, Entity result
) {
27 this(currentTransactionProvider
, Arrays
.asList(result
));
31 String
getKind(Entity entity
) {
32 return entity
.getKind();