Stay organized with collections
Save and categorize content based on your preferences.
publicinterfacePrePutimplementsAnnotation
Identifies a callback method to be invoked before an Entity of any of the specified kinds
is written to the datastore. 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 PutContext, 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 prevent the datastore operation from executing.
[[["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-08-07 UTC."],[[["\u003cp\u003e\u003ccode\u003ePrePut\u003c/code\u003e is an interface annotation that designates a callback method to be executed before an Entity is written to the datastore.\u003c/p\u003e\n"],["\u003cp\u003eThe callback, annotated with \u003ccode\u003ePrePut\u003c/code\u003e, can be configured to run for specific kinds of Entities using the \u003ccode\u003ekinds()\u003c/code\u003e method, or for all kinds if \u003ccode\u003ekinds()\u003c/code\u003e is not specified.\u003c/p\u003e\n"],["\u003cp\u003eMethods with the \u003ccode\u003ePrePut\u003c/code\u003e annotation must have specific characteristics, including returning \u003ccode\u003evoid\u003c/code\u003e, accepting a \u003ccode\u003ePutContext\u003c/code\u003e argument, and not throwing checked exceptions.\u003c/p\u003e\n"],["\u003cp\u003eThrowing an unchecked exception within a \u003ccode\u003ePrePut\u003c/code\u003e callback will stop further callbacks from running and will prevent the datastore operation.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ePrePut\u003c/code\u003e is an implementation of the Annotation interface.\u003c/p\u003e\n"]]],[],null,[]]