Processes datastore callback annotations (
PrePut, PostPut, PreDelete, PostDelete,
PreGet, com.google.appengine.api.datastore.PostLoad, PreQuery) and
generates a config file that the Datastore API can load at runtime. Each
line of the config file is of the format:
kind.callback_type=comma-separated list of methods
where 'kind' is the kind of the entity to which the config on that line
applies, 'callback_type' is one of PrePut, PostPut, PreDelete, PostDelete,
and each entry in the comma-separated list of methods is a colon-delimited
fully-qualified classname:method name tuple. So for example, if the dev
wants a method named 'prePutCallback1' belonging to class
'com.example.MyCallbacks and a method named 'prePutCallback2'
belonging to the same class to be invoked before any entity of kind 'yar' is
put, the config file will look like this:
Each type of callback has its own signature requirements for the methods it
annotates. If any of these signature requirements are violated the processor
will produce an error. See the javadoc for the annotations for more
information about the callback-specific signature requirements.
[[["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\u003eDatastoreCallbacksProcessor\u003c/code\u003e class processes various datastore callback annotations, including PrePut, PostPut, PreDelete, PostDelete, PreGet, PostLoad, and PreQuery.\u003c/p\u003e\n"],["\u003cp\u003eThis processor generates a configuration file that the Datastore API uses at runtime, defining which methods to invoke for specific entity kinds and callback types.\u003c/p\u003e\n"],["\u003cp\u003eThe configuration file format specifies the entity kind, callback type, and a comma-separated list of fully-qualified classname:method name tuples, allowing for multiple methods to be invoked for each callback.\u003c/p\u003e\n"],["\u003cp\u003eIt's possible to define callbacks that apply to all entity kinds by omitting the kind name in the configuration file, allowing for globally applicable callback methods.\u003c/p\u003e\n"],["\u003cp\u003eThe processor has a \u003ccode\u003edebug\u003c/code\u003e option to turn on debug statements, and it enforces signature requirements for callback methods, producing an error if any requirements are violated.\u003c/p\u003e\n"]]],[],null,["# Class DatastoreCallbacksProcessor (2.0.0)\n\n public class DatastoreCallbacksProcessor extends AbstractProcessor\n\nProcesses datastore callback annotations (\n[PrePut](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.PrePut), [PostPut](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.PostPut), [PreDelete](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.PreDelete), [PostDelete](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.PostDelete),\n[PreGet](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.PreGet), [com.google.appengine.api.datastore.PostLoad](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.PostLoad), [PreQuery](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.PreQuery)) and\ngenerates a config file that the Datastore API can load at runtime. Each\nline of the config file is of the format: \n\nkind.callback_type=comma-separated list of methods \n\nwhere 'kind' is the kind of the entity to which the config on that line\napplies, 'callback_type' is one of PrePut, PostPut, PreDelete, PostDelete,\nand each entry in the comma-separated list of methods is a colon-delimited\nfully-qualified classname:method name tuple. So for example, if the dev\nwants a method named 'prePutCallback1' belonging to class\n'com.example.MyCallbacks and a method named 'prePutCallback2'\nbelonging to the same class to be invoked before any entity of kind 'yar' is\nput, the config file will look like this:\n\u003e\n\u003e yar.PrePut=com.example.MyCallbacks:prePutCallback1,com.example.MyCallbacks:prePutCallback2\n\u003e\n\u003cbr /\u003e\n\nNote that it is possible to have a line which refers to all kinds by\nomitting the kind name:\n\u003e\n\u003e .PreDelete=com.example.MyCallbacks:preDeleteCallback1\n\u003e\n\u003cbr /\u003e\n\n\nEach type of callback has its own signature requirements for the methods it\nannotates. If any of these signature requirements are violated the processor\nwill produce an error. See the javadoc for the annotations for more\ninformation about the callback-specific signature requirements.\n\n\nProcessor Options:\n\n- debug - turns on debug statements\n\n\u003cbr /\u003e\n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e [AbstractProcessor](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/AbstractProcessor.html) \\\u003e DatastoreCallbacksProcessor \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-) \n[AbstractProcessor.getCompletions(Element,AnnotationMirror,ExecutableElement,String)](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/AbstractProcessor.html#getCompletions-javax.lang.model.element.Element-javax.lang.model.element.AnnotationMirror-javax.lang.model.element.ExecutableElement-java.lang.String-) \n[AbstractProcessor.getSupportedAnnotationTypes()](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/AbstractProcessor.html#getSupportedAnnotationTypes--) \n[AbstractProcessor.getSupportedOptions()](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/AbstractProcessor.html#getSupportedOptions--) \n[AbstractProcessor.getSupportedSourceVersion()](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/AbstractProcessor.html#getSupportedSourceVersion--) \n[AbstractProcessor.init(ProcessingEnvironment)](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/AbstractProcessor.html#init-javax.annotation.processing.ProcessingEnvironment-) \n[AbstractProcessor.isInitialized()](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/AbstractProcessor.html#isInitialized--) \n[AbstractProcessor.process(Set\\\u003c? extends TypeElement\\\u003e,RoundEnvironment)](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/AbstractProcessor.html#process-java.util.Set\u003c? extends javax.lang.model.element.TypeElement\u003e-javax.annotation.processing.RoundEnvironment-)\n\nConstructors\n------------\n\n### DatastoreCallbacksProcessor()\n\n public DatastoreCallbacksProcessor()\n\nMethods\n-------\n\n### getSupportedSourceVersion()\n\n public SourceVersion getSupportedSourceVersion()\n\n**Overrides** \n[AbstractProcessor.getSupportedSourceVersion()](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/AbstractProcessor.html#getSupportedSourceVersion--)\n\n### process(Set\\\u003c? extends TypeElement\\\u003e annotations, RoundEnvironment roundEnv)\n\n public boolean process(Set\u003c? extends TypeElement\u003e annotations, RoundEnvironment roundEnv)\n\n**Overrides** \n[AbstractProcessor.process(Set\\\u003c? extends TypeElement\\\u003e,RoundEnvironment)](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/AbstractProcessor.html#process-java.util.Set\u003c? extends javax.lang.model.element.TypeElement\u003e-javax.annotation.processing.RoundEnvironment-)"]]