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

org.javers.core.metamodel.annotation.DiffInclude Maven / Gradle / Ivy

There is a newer version: 7.6.2
Show newest version
package org.javers.core.metamodel.annotation;

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

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Use {@code DiffInclude} annotation to tell JaVers which properties to include in diff/commit
 * operations for a given class.
 * All other properties in this class and all properties in its subclasses will be ignored by JaVers.
 * 
* * If some properties in a subclass should be included, apply the {@code DiffInclude} annotation on them. *

* * For example, JaVers will ignore {@code bar} in the {@code A} class and both {@code bar} and {@code qux} * in the {@code B} class. *
 * class A {
 *     @Id
 *     @DiffInclude
 *     private Long id;
 *
 *     @DiffInclude
 *     private String foo;
 *
 *     private String bar;
 * }
 *
 * class B extends A {
 *     private String qux;
 * }
 * 
* * * The above is equivalent to: *
 * class A {
 *     @Id
 *     private Long id;
 *
 *     private String foo;
 *
 *     @DiffIgnore
 *     private String bar;
 * }
 *
 * class B extends A {
 *     @DiffIgnore
 *     private String qux;
 * }
 * 
* * Warning: {@code DiffInclude} can't be mixed with {@code DiffIgnore} in the same class. * * @see DiffIgnore * @author Iulian Stefanica */ @Target({METHOD, FIELD}) @Retention(RUNTIME) public @interface DiffInclude { }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy