com.googlecode.objectify.condition.IfDefault 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.condition;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import com.googlecode.objectify.impl.TypeUtils;
/**
* This condition tests against the default value of the field that it
* is placed upon, whatever that default may be. If you
* initialize the field with a value, this condition will use that value
* as the comparison. For example, if you have a class like this:
*
*
* public class MyEntity {
* @Id Long id;
* @NotSaved(IfDefault.class) String foo = "defaultFoo";
* }
*
*
* The {@code foo} field will be left unsaved when it has the value "defaultFoo".
*
* Specifically, this conditional constructs an instance of your entity class
* using the default (no-arg) constructor and stores the default field value for
* later comparison. Note that if you initialize the field in your default constructor,
* this counts!
*
* @author Jeff Schnitzer
*/
public class IfDefault extends ValueIf