
de.bild.codec.annotations.Discriminator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of polymorphia Show documentation
Show all versions of polymorphia Show documentation
A very fast POJO codec for MongoDB (used in conjunction with the Mongo Java Driver) that handles generic types as well as polymorphic class hierarchies
The newest version!
package de.bild.codec.annotations;
import java.lang.annotation.*;
/**
* If you want to choose your discriminator manually you can annotate your pojo classes with this annotation.
* Within the value array, provide ALL discriminators that identify your pojo
* (if you have used different ones within mongo and do not want to change existing ones)
* The first entry in this list will be used for current encodings to the database.
*
* If no discriminator annotation is present at your pojo class, the {@link Class#getSimpleName()} will
* be used in case a polymorphic data structure is found.
*
* Please be aware that using the same discriminator could potentially lead to ambiguities, IF such classes
* are assignable to each other.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Discriminator {
String value();
String[] aliases() default {};
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy