Java 8 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Java 8
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Java
8 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Java.
PreQueryContext (Google App Engine API for Java)
Stay organized with collections
Save and categorize content based on your preferences.
- java.lang.Object
-
- com.google.appengine.api.datastore.PreQueryContext
-
- All Implemented Interfaces:
- CallbackContext<Query>
public final class PreQueryContext
extends java.lang.Object
Concrete
CallbackContext
implementation that is specific to intercepted queries. Methods
annotated with
PreQuery
that receive instances of this class may modify the
Query
returned by calling
getCurrentElement()
. This is an effective way to modify queries
prior to execution.
-
-
Method Summary
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
Method Detail
-
getElements
public java.util.List<T> getElements()
- Specified by:
getElements
in interface CallbackContext<T>
- Returns:
- An unmodifiable view of the elements involved in the operation that triggered the
callback..
-
getCurrentElement
public T getCurrentElement()
- Specified by:
getCurrentElement
in interface CallbackContext<T>
- Returns:
- The element for which the callback has been invoked. Shortcut for
getElements().getCurrentIndex()
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["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-06-16 UTC."],[[["\u003cp\u003e\u003ccode\u003ePreQueryContext\u003c/code\u003e is a concrete implementation of \u003ccode\u003eCallbackContext\u003c/code\u003e specifically for intercepted queries.\u003c/p\u003e\n"],["\u003cp\u003eMethods annotated with \u003ccode\u003ePreQuery\u003c/code\u003e that receive \u003ccode\u003ePreQueryContext\u003c/code\u003e instances can modify the \u003ccode\u003eQuery\u003c/code\u003e via the \u003ccode\u003egetCurrentElement()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetElements()\u003c/code\u003e provides an unmodifiable view of the elements involved in the callback-triggering operation.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetCurrentTransaction()\u003c/code\u003e returns the current transaction or \u003ccode\u003enull\u003c/code\u003e if none exists.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetCurrentIndex()\u003c/code\u003e indicates the index of the element in the result of \u003ccode\u003egetElements()\u003c/code\u003e for which the callback is active, and \u003ccode\u003egetCurrentElement()\u003c/code\u003e returns the element itself.\u003c/p\u003e\n"]]],[],null,["# PreQueryContext (Google App Engine API for Java)\n\ncom.google.appengine.api.datastore\n\nClass PreQueryContext\n---------------------\n\n- java.lang.Object\n-\n - com.google.appengine.api.datastore.PreQueryContext\n\n-\n\n All Implemented Interfaces:\n : [CallbackContext](../../../../../com/google/appengine/api/datastore/CallbackContext.html \"interface in com.google.appengine.api.datastore\")\\\u003c[Query](../../../../../com/google/appengine/api/datastore/Query.html \"class in com.google.appengine.api.datastore\")\\\u003e\n\n *** ** * ** ***\n\n \u003cbr /\u003e\n\n ```\n public final class PreQueryContext\n extends java.lang.Object\n ``` \nConcrete [`CallbackContext`](../../../../../com/google/appengine/api/datastore/CallbackContext.html \"interface in com.google.appengine.api.datastore\") implementation that is specific to intercepted queries. Methods annotated with [`PreQuery`](../../../../../com/google/appengine/api/datastore/PreQuery.html \"annotation in com.google.appengine.api.datastore\") that receive instances of this class may modify the [`Query`](../../../../../com/google/appengine/api/datastore/Query.html \"class in com.google.appengine.api.datastore\") returned by calling [`getCurrentElement()`](../../../../../com/google/appengine/api/datastore/PreQueryContext.html#getCurrentElement--). This is an effective way to modify queries prior to execution. \n-\n -\n\n ### Method Summary\n\n -\n\n ### Methods inherited from class java.lang.Object\n\n`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait` \n-\n -\n\n ### Method Detail\n\n\n -\n\n #### getElements\n\n ```\n public java.util.List\u003cT\u003e getElements()\n ```\n\n Specified by:\n : [getElements](../../../../../com/google/appengine/api/datastore/CallbackContext.html#getElements--) in interface [CallbackContext](../../../../../com/google/appengine/api/datastore/CallbackContext.html \"interface in com.google.appengine.api.datastore\")`\u003cT\u003e`\n\n Returns:\n : An unmodifiable view of the elements involved in the operation that triggered the\n callback..\n\n\n -\n\n #### getCurrentTransaction\n\n ```\n public Transaction getCurrentTransaction()\n ```\n\n Specified by:\n : [getCurrentTransaction](../../../../../com/google/appengine/api/datastore/CallbackContext.html#getCurrentTransaction--) in interface [CallbackContext](../../../../../com/google/appengine/api/datastore/CallbackContext.html \"interface in com.google.appengine.api.datastore\")`\u003cT\u003e`\n\n Returns:\n : The current transaction, or `null` if there is no current transaction.\n\n\n -\n\n #### getCurrentIndex\n\n ```\n public int getCurrentIndex()\n ```\n\n Specified by:\n : [getCurrentIndex](../../../../../com/google/appengine/api/datastore/CallbackContext.html#getCurrentIndex--) in interface [CallbackContext](../../../../../com/google/appengine/api/datastore/CallbackContext.html \"interface in com.google.appengine.api.datastore\")`\u003cT\u003e`\n\n Returns:\n : The index in the result of [`CallbackContext.getElements()`](../../../../../com/google/appengine/api/datastore/CallbackContext.html#getElements--) of the element for which the callback\n has been invoked.\n\n\n -\n\n #### getCurrentElement\n\n ```\n public T getCurrentElement()\n ```\n\n Specified by:\n : [getCurrentElement](../../../../../com/google/appengine/api/datastore/CallbackContext.html#getCurrentElement--) in interface [CallbackContext](../../../../../com/google/appengine/api/datastore/CallbackContext.html \"interface in com.google.appengine.api.datastore\")`\u003cT\u003e`\n\n Returns:\n : The element for which the callback has been invoked. Shortcut for `getElements().getCurrentIndex()`.\n\n\n -\n\n #### toString\n\n ```\n public java.lang.String toString()\n ```\n\n Overrides:\n : `toString` in class `java.lang.Object`"]]