
com.aerospike.mapper.annotations.AerospikeVersion Maven / Gradle / Ivy
package com.aerospike.mapper.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify the version of a record. Records without the @AerospikeVersion annotation are assumed to be version 1 of a record.
*
* Versions are typically used for embedded records to be stored in a list. Since a list item has no name associated with it,
* the order of the attributes determines which part of the object to map the value to. By default the items are mapped
* alphabetically, but this presents issues is an item is added or removed from the object.
*
* For example, consider a Person object with an Account stored as a list:
*
* @AerospikeRecord(namespace = "test", set = "account")
* public class Account {
* @AerospikeBin
* private String name;
* @AerospikeBin
* private int balance
* }
*
* @AerospikeRecord(namespace = "test", set = "people")
* public class Person {
* @AerospikeBin
* private String name;
* @AerospikeBin
* @AerospikeEmbed(type = EmbedType.LIST)
* private Account account;
* }
*
*
* @author timfaulkes
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target( {ElementType.FIELD, ElementType.METHOD})
public @interface AerospikeVersion {
int min() default 1;
int max() default Integer.MAX_VALUE;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy