Revision created by MOE tool push_codebase.
[gae.git] / java / src / main / com / google / appengine / api / datastore / CallbackContext.java
blob72c34203281231fb5769046cf44cbbc10a89fd9c
1 // Copyright 2011 Google Inc. All Rights Reserved.
2 package com.google.appengine.api.datastore;
4 import java.util.List;
6 /**
7 * Describes the context in which a callback runs. The context has access to
8 * the current transaction (if any), the element that the callback is
9 * operating on (eg the Entity being put or the Key being deleted), as well as
10 * all elements being operated on in the operation that triggered the callback..
12 * @param <T> the type of element that the callback is acting on.
15 public interface CallbackContext<T> {
16 /**
17 * @return An unmodifiable view of the elements involved in the operation
18 * that triggered the callback..
20 List<T> getElements();
22 /**
23 * @return The current transaction, or {@code null} if there is no current
24 * transaction.
26 Transaction getCurrentTransaction();
28 /**
29 * @return The index in the result of {@link #getElements()} of the element
30 * for which the callback has been invoked.
32 int getCurrentIndex();
34 /**
35 * @return The element for which the callback has been invoked. Shortcut
36 * for {@code getElements().getCurrentIndex()}.
38 T getCurrentElement();