com.googlecode.objectify.annotation.NotSaved Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of objectify Show documentation
Show all versions of objectify Show documentation
*** THIS VERSION UPLOADED FOR USE WITH CEDAR-COMMON, TO AVOID DEPENDENCIES ON GOOGLE CODE-BASED MAVEN REPOSITORIES. *** The simplest convenient interface to the Google App Engine datastore
The newest version!
package com.googlecode.objectify.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.googlecode.objectify.condition.If;
/**
* When placed on an entity field, the field will not be written to the datastore.
* It will, however, be loaded normally. This is particularly useful in concert with
* {@code @PostLoad} and {@code @PrePersist} to transform your data.
*
* If passed one or more classes that implement the {@code If} interface, the
* value will be NotSaved only if it tests positive for any of the conditions. This
* is a convenient way to prevent storing of default values, potentially saving
* a significant amount of storage and indexing cost.
*
* @author Jeff Schnitzer
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface NotSaved
{
// Fully specifying the default value works around a bizarre compiler bug:
// http://stackoverflow.com/questions/1425088/incompatible-types-found-required-default-enums-in-annotations
Class>[] value() default { com.googlecode.objectify.condition.Always.class };
}