Stay organized with collections
Save and categorize content based on your preferences.
publicinterfaceCallbackContext<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()
publicabstractTgetCurrentElement()
Returns the element for which the callback has been invoked. Shortcut for
getElements().getCurrentIndex().
Returns
Type
Description
T
getCurrentIndex()
publicabstractintgetCurrentIndex()
Returns the index in the result of #getElements() of the element for which the callback
has been invoked.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eCallbackContext<T>\u003c/code\u003e interface provides context for callback execution, including access to the current transaction and the element being operated on.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetCurrentElement()\u003c/code\u003e returns the specific element associated with the callback invocation, equivalent to the element at the current index in the list of elements.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetCurrentIndex()\u003c/code\u003e returns the position of the current element within the list of elements affected by the operation.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetCurrentTransaction()\u003c/code\u003e provides access to the ongoing transaction, returning null if no transaction is active.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetElements()\u003c/code\u003e returns a read-only view of all the elements involved in the operation that triggered the callback.\u003c/p\u003e\n"]]],[],null,["# Interface CallbackContext<T> (2.0.0)\n\n public interface CallbackContext\u003cT\u003e\n\nDescribes the context in which a callback runs. The context has access to the current transaction\n(if any), the element that the callback is operating on (eg the Entity being put or the Key being\ndeleted), as well as all elements being operated on in the operation that triggered the\ncallback..\n\nMethods\n-------\n\n### getCurrentElement()\n\n public abstract T getCurrentElement()\n\nReturns the element for which the callback has been invoked. Shortcut for `\ngetElements().getCurrentIndex()`.\n\n### getCurrentIndex()\n\n public abstract int getCurrentIndex()\n\nReturns the index in the result of [#getElements()](/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\nhas been invoked.\n\n### getCurrentTransaction()\n\n public abstract Transaction getCurrentTransaction()\n\nReturns the current transaction, or `null` if there is no current transaction.\n\n### getElements()\n\n public abstract List\u003cT\u003e getElements()\n\nReturns an unmodifiable view of the elements involved in the operation that triggered the\ncallback.."]]