org.javers.core.metamodel.annotation.TypeName 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 org.javers.core.JaversBuilder;
import org.javers.repository.api.JaversRepository;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Gives a persistent and human-readable type name for Entity or ValueObject.
* This name is used everywhere by JaVers, instead of a fragile, fully-qualified class name.
*
*
* Naming types is recommended if you are
* using {@link JaversRepository}.
* It fosters refactoring of package names and class names.
*
*
* Usage example:
*
*{@literal @}Entity
*{@literal @}TypeName("Person")
* class Person {
* {@literal @}Id
* private int id;
* private String name;
* }
*
*
* {@literal @}TypeName works similarly to org.springframework.data.annotation.TypeAlias
* in Spring Data.
*
*
*
* Important
* All classes with {@literal @}TypeName should be registered using {@link JaversBuilder#withPackagesToScan(String)}
* or javers.packagesToScan
Spring Boot starter property.
*
* @see PropertyName
* @see Entity
* @see ValueObject
* @since 1.4
* @author bartosz.walacik
*/
@Target(TYPE)
@Retention(RUNTIME)
public @interface TypeName {
/**
* The type name to be used when comparing and persisting
*/
String value();
}