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

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

There is a newer version: 7.6.2
Show newest version
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(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy