All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.appengine.api.datastore.PreGet Maven / Gradle / Ivy

Go to download

API for Google App Engine standard environment with some of the dependencies shaded (repackaged)

There is a newer version: 2.0.27
Show newest version
/*
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.appengine.api.datastore;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Identifies a callback method to be invoked before an {@link Entity} of any of the specified kinds
 * is fetched from the datastore via a get() rpc. If {@link #kinds()} is not provided the callback
 * will execute for all kinds. Methods with this annotation must return {@code void}, must accept a
 * single argument of type {@link PreGetContext}, 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.
 *
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface PreGet {

  /**
   * The kinds to which this callback applies. The default value is an empty array, which indicates
   * that the callback should run for all kinds.
   *
   * @return The kinds to which this callback applies.
   */
  String[] kinds() default {};
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy