1 // Copyright 2011 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.datastore
;
5 import java
.lang
.annotation
.ElementType
;
6 import java
.lang
.annotation
.Retention
;
7 import java
.lang
.annotation
.RetentionPolicy
;
8 import java
.lang
.annotation
.Target
;
11 * Identifies a callback method to be invoked after an {@link Entity} of any of
12 * the specified kinds is written to the datastore. If {@link #kinds()} is not
13 * provided the callback will execute for all kinds. Methods with this
14 * annotation must return {@code void}, must accept a single argument of type
15 * {@link PutContext}, must not throw any checked exceptions, must not be
16 * static, and must belong to a class with a no-arg constructor. Neither the
17 * method nor the no-arg constructor of the class to which it belongs are
18 * required to be public. Methods with this annotation are free to throw any
19 * unchecked exception they like. Throwing an unchecked exception will prevent
20 * callbacks that have not yet been executed from running, and the exception
21 * will propagate to the code that invoked the datastore operation that
22 * resulted in the invocation of the callback. Throwing an unchecked exception
23 * from a callback will <b>not</b> have any impact on the result of the
24 * datastore operation. Methods with this annotation will not be invoked if
25 * the datastore operation fails.
28 @Target(ElementType
.METHOD
)
29 @Retention(RetentionPolicy
.RUNTIME
)
30 public @interface PostPut
{
32 * The kinds to which this callback applies. The default value is an empty
33 * array, which indicates that the callback should run for all kinds.
35 * @return The kinds to which this callback applies.
37 String
[] kinds() default {};