PostLoad (Google App Engine API for Java)
Stay organized with collections
Save and categorize content based on your preferences.
-
@Target(value=METHOD)
@Retention(value=RUNTIME)
public @interface PostLoad
Identifies a callback method to be invoked after an
Entity
of any of the specified kinds
is loaded from the datastore. This can happen as the result of a get() operation or a query. If
kinds()
is not provided the callback will execute for all kinds. Methods with this
annotation must return
void
, must accept a single argument of type
PostLoadContext
, must not throw any checked exceptions, must not be static, and must belong to a
class with a no-arg constructor. Neither the method nor the no-arg constructor of the class to
which it belongs are required to be public. Methods with this annotation are free to throw any
unchecked exception they like. Throwing an unchecked exception will prevent callbacks that have
not yet been executed from running, and the exception will propagate to the code that invoked the
datastore operation that resulted in the invocation of the callback. Throwing an unchecked
exception from a callback will
not have any impact on the result of the datastore
operation. Methods with this annotation will not be invoked if the datastore operation fails.
-
-
Optional Element Summary
Optional Elements
Modifier and Type |
Optional Element and Description |
java.lang.String[] |
kinds
The kinds to which this callback applies.
|
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."],[[["The `@PostLoad` annotation designates a method to be called after an `Entity` is loaded from the datastore, either through a get operation or a query."],["Callback methods annotated with `@PostLoad` must return `void`, accept a single `PostLoadContext` argument, be non-static, belong to a class with a no-arg constructor, and must not throw checked exceptions."],["The `kinds` element of `@PostLoad` specifies which `Entity` kinds trigger the callback, and by default, an empty array indicates that all kinds will trigger it."],["Throwing an unchecked exception within a `@PostLoad` callback will halt subsequent callbacks but will not impact the result of the datastore operation that caused the callback."]]],[]]