# Interface CallbackContext&lt;T&gt; (5.0.3)

    public interface CallbackContext<T>

Describes the context in which a callback runs. The context has access to the current transaction
(if any), the element that the callback is operating on (eg the Entity being put or the Key being
deleted), as well as all elements being operated on in the operation that triggered the
callback..

| ## Type Parameter ||
|---|---|
| **Name** | **Description** |
| `T` |   |

## Methods

### getCurrentElement()

    public abstract T getCurrentElement()

Returns the element for which the callback has been invoked. Shortcut for `
getElements().getCurrentIndex()`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` |   |

### getCurrentIndex()

    public abstract int getCurrentIndex()

Returns the index in the result of [#getElements()](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.CallbackContext#com_google_appengine_api_datastore_CallbackContext_getElements__) of the element for which the callback
has been invoked.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getCurrentTransaction()

    public abstract Transaction getCurrentTransaction()

Returns the current transaction, or `null` if there is no current transaction.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.Transaction` |   |

### getElements()

    public abstract List<T> getElements()

Returns an unmodifiable view of the elements involved in the operation that triggered the
callback..

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<T>` |   |