org.javers.core.metamodel.annotation.DiffInclude Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javers-core Show documentation
Show all versions of javers-core Show documentation
JaVers - object auditing and diff framework for Java
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 {
}